#1 (permalink)  
Old 02-15-2007, 09:37 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
Row Of Images With Captions

I'm looking for a good way to create a row of images, each with a caption underneath.

Obviously, I'm trying to avoid the use of tables, so I'm having a little trouble.

Normally, if I were using tables, the code would look something like:
Code:
<table>
<tr>
<td>
<img src='myimage1.jpg' alt='myimage1' />
<p>This is my first image</p>
</td>
<td>
<img src='myimage2.jpg' alt='myimage2' />
<p>This is my second image</p>
</td>
<td>
<img src='myimage3.jpg' alt='myimage3' />
<p>This is my third image</p>
</td>
</tr>
</table>
However, since those images are not actually tabular data, I'm trying to avoid the use of tables. That leaves me in somewhat of a delicate position. Normally, if I were just trying to create a row of images, I would use either inline divs or an inline unordered list. However, the fact that I need to have captions underneath each of those images makes that impossible.

Why does that make it impossible (at least, as far as I can tell)? Here's why: In order to add a caption underneath the image, I have to use a block level element (in other words, in order to start a new line after the image). If I use a block level element, that breaks my line, which causes the next image to either go on the same line as my previous caption, or it causes my next image to go on its own line.

Any help from anyone that's already made the switch to completely tableless layouts would be greatly appreciated.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote

  #2 (permalink)  
Old 02-15-2007, 02:11 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
I looked for my previous post to help that science dude, but I could not find it. I recall his solution going a little like this
HTML Code:
<div style="float:left; width:#; height:#; text-align:center;"><img src="file.ext" /><br />Description 1, 2, 3</div>
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
         ...,,.,.,.
        /          \
__oooo__[///]--[\\\]__oooo__
Reply With Quote
  #3 (permalink)  
Old 02-16-2007, 03:29 PM
Registered User
 
Join Date: Jun 2004
Location: Ann Arbor, MI, USA
Posts: 73
Send a message via ICQ to \Kritikal\ Send a message via AIM to \Kritikal\
You could also use an unordered list and set the display to inline for the list item children. Inside your list item just have your standard:
Code:
<div><img src="blah.jpg" /></div><div>Caption</div>
I put each in it's own div because really, you're dividing the list item into divisions. Makes for good semantic code.
__________________
-\Kritikal\-
Reply With Quote
  #4 (permalink)  
Old 02-17-2007, 08:50 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
Unfortunately, at least the way I just tried that, it puts the images in a column together, rather than putting them in a row together.

I fear that the only way to achieve this is to either build the captions into the images (which is not really an option), or to put the images into a table.

If you want to see what I'm trying to do, you can check out http://dev.dcevolution.net/index.php...lection_dsvol1 for an example. The three screenshots at the top of that page need to be in a row together like that, with captions underneath each image. When the site is finished, there will be about 40-50 pages all with screenshot rows like that.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
  #5 (permalink)  
Old 02-17-2007, 09:17 AM
Registered User
 
Join Date: Jun 2004
Location: Ann Arbor, MI, USA
Posts: 73
Send a message via ICQ to \Kritikal\ Send a message via AIM to \Kritikal\
This worked for me:

http://kritikal.dyndns.org/temp/thum...humbnails.html
__________________
-\Kritikal\-
Reply With Quote
  #6 (permalink)  
Old 02-17-2007, 11:21 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
You're right. That appears to have worked almost beautifully. The only two problems I have now are:
1) I can't center the row of screenshots. Not a biggie, but it would have been nice to have the screenshots centered within the containing block.
2) If you resize the window to a smaller size, the screenshots then get stacked on top of each other, which is fine, except that the padding and margins don't seem to apply properly when that happens, so my bulleted lists end up with the bullets inside of the screenshot divs.
Like I said, the first one's not a huge deal, but I really would like to find a way to fix the second problem. Any thoughts? I really appreciate your help.

I also played with a couple other ideas on how to layout the page with screenshots. Here are some pics of what the various items look like:

Layout 1 (with the screenshots in a row, as we've been discussing in this topic):


Layout 2 (with the screenshots in a column down the left side - problem #2 I mentioned above is present within this layout, too, though):


Layout 3 (with the screenshots in a column down the right side - problem #2 mentioned above doesn't exist in this pic, but the text still goes right up against the borders of the screenshot divs):


Here is an isolated shot of Problem #2 I mentioned above:


What are your thoughts?
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
  #7 (permalink)  
Old 02-17-2007, 10:12 PM
Registered User
 
Join Date: Jun 2004
Location: Ann Arbor, MI, USA
Posts: 73
Send a message via ICQ to \Kritikal\ Send a message via AIM to \Kritikal\
Try putting a div in with the rest of the thumbnails:

Code:
<div style="clear: both;"></div>
__________________
-\Kritikal\-
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
layered images w/o absolute positioning? VaporAction Programming and Scripting 1 01-26-2007 07:07 PM
Loading correct images.. yuppicide Programming and Scripting 5 01-24-2007 06:57 AM
How do I write on top of images? henryjl Off-Topic 4 01-17-2007 07:42 PM
Rolling over a different series of images? cprescott1972 Programming and Scripting 1 09-16-2006 10:24 PM
Urgent help wanted in digitazing some images! happy5 Graphics and Flash 2 07-30-2005 07:08 AM


All times are GMT -5. The time now is 05:36 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter