OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

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
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> 3 Images with text underneath them in a div instead of a table
Page: [1]
 
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.
Tailslide

 

Posts: 6692
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/16/2009 15:27:16   
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.

_____________________________

Little Blue Plane Web Design | Land Rover project

:)

(in reply to Danaldinho)
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 :)

(in reply to Tailslide)
Tailslide

 

Posts: 6692
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 3:25:40   
Doh! see that's what happens when you answer posts late at night!

Forgot to add - float:left to the box rule.

You also don't need the line break between the divs - if you have the measurements right it will just float down to the next line automatically.

_____________________________

Little Blue Plane Web Design | Land Rover project

:)

(in reply to Danaldinho)
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 >

(in reply to Tailslide)
Tailslide

 

Posts: 6692
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 11:04:22   
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.

_____________________________

Little Blue Plane Web Design | Land Rover project

:)

(in reply to Danaldinho)
jaybee

 

Posts: 14320
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 12:08:05   
quote:

Hey, thanks for the reply mate


Psssst...

Tailslide is a Matess :)

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Tailslide)
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 :)

(in reply to Tailslide)
Danaldinho

 

Posts: 20
Joined: 1/7/2008
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 12:18:41   

quote:

ORIGINAL: jaybee

quote:

Hey, thanks for the reply mate


Psssst...

Tailslide is a Matess :)


Ok, thanks :)

Sorry Tailslide :)

(in reply to jaybee)
Tailslide

 

Posts: 6692
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 14:37:15   
Yep spans are better. If you can do without anything then that's great (e.g. if it's a paragraph within the div then you can set up a rule that singles out all paragraphs within a div called whatever). But if not then spans are better.

You can't easily have two on the top row and three beneath unless you add in a break. They will float next to each other naturally until they run out of space when they'll go down to the next line.

_____________________________

Little Blue Plane Web Design | Land Rover project

:)

(in reply to Danaldinho)
Danaldinho

 

Posts: 20
Joined: 1/7/2008
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 14:52:03   

quote:

ORIGINAL: Tailslide

Yep spans are better. If you can do without anything then that's great (e.g. if it's a paragraph within the div then you can set up a rule that singles out all paragraphs within a div called whatever). But if not then spans are better.

You can't easily have two on the top row and three beneath unless you add in a break. They will float next to each other naturally until they run out of space when they'll go down to the next line.


Oh, ok then :)

Well, do you know how to display them in the center?

(in reply to Tailslide)
Tailslide

 

Posts: 6692
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 15:50:55   
You can have three and two - you'll just need to have a break between the two rows.

Do you mean having the photos in the centre of each div? (add margins to each side is the easiest) or do you mean centering the divs themselves? That's harder - real pain if you have three and two. I'd have a wrapper div around each row, work out the margins exactly and then set a width for the wrapper div and center that.

_____________________________

Little Blue Plane Web Design | Land Rover project

:)

(in reply to Danaldinho)
Danaldinho

 

Posts: 20
Joined: 1/7/2008
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/17/2009 16:11:41   

quote:

ORIGINAL: Tailslide

You can have three and two - you'll just need to have a break between the two rows.

Do you mean having the photos in the centre of each div? (add margins to each side is the easiest) or do you mean centering the divs themselves? That's harder - real pain if you have three and two. I'd have a wrapper div around each row, work out the margins exactly and then set a width for the wrapper div and center that.



I think we have done it :)

http://www.lilwaynehq.com/discography/discography2.php

Looks fine to me :)

I would like to say a big thanks, I couldn't of done this without you.

I really appreciate all the help you have given me.

(in reply to Tailslide)
jaybee

 

Posts: 14320
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/18/2009 6:59:22   
Looks great. :)

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Danaldinho)
Danaldinho

 

Posts: 20
Joined: 1/7/2008
Status: offline

 
RE: 3 Images with text underneath them in a div instead... - 3/18/2009 11:20:58   
Yeah, thanks :)

Thanks again Tailslide :)

(in reply to jaybee)
Page:   [1]

All Forums >> Web Development >> General Web Development >> 3 Images with text underneath them in a div instead of a table
Page: [1]
Jump to: 1





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