homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Vertical text align in table cell
Aligning text vertically in a table cell

 2:34 pm on May 19, 2007 (gmt 0)

I've created a table and put a picture in each cell.

<td valign=top>
<img src="Image_one.jpg">
<td valign=top>
<img src="Image_two.jpg">

I can vertically align the text using the HTML code valign=top. And the problem is, if I do it that way, I have to write the same code in every <td> tag. And I'd like to do the same thing using CSS and align the text in all the table cells at once. But I don't know the CSS code for it. Help!

And a similar question, if I use photos instead of text, do I need a different code?



 11:51 pm on May 19, 2007 (gmt 0)

td img{vertical-align:middle}
Will vertically align the inline elements which come after it (text image, span, etc.) centered to the image.


 4:09 pm on May 20, 2007 (gmt 0)

Thanks X. That worked like a charm.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved