|
| |
3 Images with text underneath them in a div instead of a table
View related threads:
(in this forum
| in all forums)
|
Logged in as: Guest
|
|
|
Danaldinho
Posts: 20 Joined: 1/7/2008 Status: offline
|
3 Images with text underneath them in a div instead of ... - 3/16/2009 14:11:15
Hey guys, I have made a table which can have up to three images side by side with a little bit of space in between them and then some text underneath them. You can see this here: http://www.lilwaynehq.com/discography But what I want to do, is scrap is the tables and use divs as I am hearing so many bad things with tables now. Could someone please start me off, because I haven't really used divs before. Thanks alot and I really appreciate it.
|
|
|
|
Danaldinho
Posts: 20 Joined: 1/7/2008 Status: offline
|
RE: 3 Images with text underneath them in a div instead... - 3/16/2009 16:09:15
quote:
ORIGINAL: Tailslide You want to have a div with a photo and a sentence under it then reuse as necessary. I'm on the mac so I don't know the measurements so you'll need to change those to the appropriate amount. Make sure you've got a full valid DOCTYPE otherwise browsers will b e in quirks mode and won't be reliable. <div class="box"
<img src="images/photo.jpg" alt="">
<p>Caption for the photo</p>
</div> div.box {width:100px; margin:10px 10px 10px 0; display:inline; }
div.box img {display:block; margin: 0 auto;}
div.box p {margin: 10px;text-align:center;} The display:inline bit is to counter an IE bug which doubles the margin width. If you want the rar right hand box to have no right hand margin then you'd add a class to that final box to remove the right hand margin. <div class="box last"
<img src="images/photo.jpg" alt="">
<p>Caption for the photo</p>
</div>
div.last {margin-right:0;} That removes just the right hand margin for the right hand box - all other rules apply from the class box. quote:
div.box {width:100px; margin:10px 10px 10px 0; display:inline; } div.box img {display:block; margin: 0 auto;} div.box p {margin: 10px;text-align:center;} Hey, thanks for the reply mate, I really appreciate it. Anyway I have done what you have said here: http://www.lilwaynehq.com/discography/discography2.php But as you can see, its not displaying the images on the same line. It's doing them one by one underneath each other. Do you know how to fix that? Thanks :)
|
|
|
|
Danaldinho
Posts: 20 Joined: 1/7/2008 Status: offline
|
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 10:02:36
Hehe, its fine :P And ok, I have added the float: left to the box class And, I am currently using this code now: <div class="disco">
<img src="/discography/noimage.jpg" alt="Tha Carter IV" border="1" />
<p>Tha Carter IV<br /><small><font color="blue">TBA</font></small></p>
</div>
<div class="disco">
<img src="/discography/noimage.jpg" alt="Tha Carter III: Rebirth" border="1" />
<p>Rebirth<br /><small><font color="blue">TBA</font></small></p>
</div>
<br />
<div class="disco">
<img src="/discography/thecarter3.jpg" alt="Tha Carter III" border="1" />
<p>Tha Carter III</p>
</div>
<div class="disco">
<img src="/discography/thecarter2.jpg" alt="Tha Carter II" border="1" />
<p>Tha Carter II</p>
</div>
<div class="disco">
<img src="/discography/thecarter.jpg" alt="Tha Carter" border="1" />
<p>Tha Carter</p>
</div> Because like I said, I want it look like this page: http://www.lilwaynehq.com/discography But if you look on http://www.lilwaynehq.com/discography/discography2.php, you can see it still doesn not look like that other page and I have messed around with the width, but still no luck :( So do you know what else needs to be done. Thanks :) :)
< Message edited by Danaldinho -- 3/17/2009 10:18:06 >
|
|
|
|
Danaldinho
Posts: 20 Joined: 1/7/2008 Status: offline
|
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 12:16:48
quote:
ORIGINAL: Tailslide Ok - I've done a test page for you. All I've corrected is the stuff directly concerned with what we're doing. TEST PAGE I'd had to remove your scripting as it was crashing my FTP for some reason. What I've done: 1. add a min-height to the .disco rule. This ensures that everything should float nicely under the row above. 2. Added clear:both to the paragraph underneath to clear the boxes. 3. Changed the H1s to H3s (you should only have 1 H1 on a page) and added clear:both to it. 4. Got rid of all the nasty font tags - no reason other than you don't need that rubbish! That's about it. Should work. Hey, ok thanks alot :) Its looking alot better now - http://www.lilwaynehq.com/discography/discography2.php Also when you removed the font tags and all that stuff, I added it in span tags again (is that better?) And lastly, do you know how to display the images in the center and also how to start the images from the other way around (so there will always be 3 on the bottom line and 2 on the top) (like on this page: http://www.lilwaynehq.com/discography ) Thanks again :)
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|