Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text & Image inside table wont center

Status
Not open for further replies.

stax

Technical User
Sep 25, 2002
81
US
Hi, I have text and an image inside the same table I cant get the text to stay in the middle and hard left. Can anyone tell me if my code is wrong?

<td height="14" colspan="3" align="left" valign="middle"><img src="images/news_icon.jpg" width="17" height="17" /><font size="1" face="Arial, Helvetica, sans-serif" ><strong>
News | Article: </strong>Product Lanuch <strong> Added: </strong>08/21/07</font></td>

Incidentally if i remove the image the text will center.

Any help would be apprieciated!
S
 
I am sure I am not understand what exactly it is you want, but if you want to center all your content, you need to align it there:
Code:
<td height="14" colspan="3" [!]align="center"[/!] valign="middle">
  <img src="images/news_icon.jpg" width="17" height="17" />
  <font size="1" face="Arial, Helvetica, sans-serif">
    <strong>News | Article: </strong>
    Product Lanuch <strong> Added: </strong>08/21/07
  </font>
</td>
That said, I do not think table is an appropriate element to render what you're doing and I do not think you should be using font tags still.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
I have an table with an image and text in it, the text stays at the bottom of the table and i want its vertical position to be in the middle. If i remove the image it will go to the middle.

Also, dreamweaver puts the font tags in when you select the font that you want, how else would it know what font i wanted displayed?
 
If you would have said vertically aligned in the middle, things would be much clearer. By default, the picture will align to the baseline of the text (the bottom of the picture will be where the bottom of the letters is -- except for letters that hang below that). You can change that by adding vertical align to the image tag:
Code:
<td height="14" colspan="3" align="center" valign="middle">
  <img src="images/news_icon.jpg" width="17" height="17" style="vertical-align: middle;" />
  <font size="1" face="Arial, Helvetica, sans-serif">
    <strong>News | Article: </strong>
    Product Lanuch <strong> Added: </strong>08/21/07
  </font>
</td>
I still suggest you ditch Dreamweaver and find a tool that lets you design websites in a modern fashion -- semantic HTML for structure and CSS for layout.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
As you have posted in the HTML and CSS forum, it is a reasonable supposition that you are using CSS. That is the usual way to specify all the presentation (rather than content) elements of a website. Use of CSS allows you to define positioning and font for all your elements. If you're not familiar with it start at
___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
How about using another table inside that table. You can then set the cell heights so that they display what you want int he exact positions you want
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top