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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image is not centered??? 3

Status
Not open for further replies.

tijerina

Vendor
Mar 4, 2003
132
US
I have a site that has three images centered on the main page (index.php).

Image1 Image2 Image3


When I replace Image2 with another image (.bmp) it looks like this.

Image1Image2 Image3.

Image2 moves to the left and is no longer centered between Image1 and Image3.

Here is the code snipit.

--------Start of Snipit-----------------------

<td bgcolor="ffffff" width="217" height="28" >
<a href=" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image50','','images/specials_over_01.gif',1)"><img name="Image50" border="0" src="images/specials_01.gif" align="middle" ></a>
</td>
<td bgcolor="ffffff" width="214" height="28" >
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image51','','images/wrenchincomputer.bmp',1)"><img name="Image51" border="0" src="images/wrenchincomputer.bmp" align="middle" ></a>
</td>
<td bgcolor="ffffff" width="219" height="28" >
<a href=" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image53','','images/specials_over_03.gif',1)"><img name="Image53" border="0" src="images/specials_03.gif" align="middle" ></a>
</td>
</table>

---------End of Snipit-----------------------

Why is Image2 not centered between Image1 and Image3?

Thanks.
 
As far as I remember, <IMG align=...> is deprecated construct and works OK only for left/right.

Remove align="middle" from IMG tags and insert align="center" in TD tags.
 
Try adding alignment to your table cells:

<td bgcolor="ffffff" width="214" height="28" align="center">

Do the same for the other cells if you wish.
 
I am surprised align='middle' worked at all (even initially). 'middle' is generally used when discussing vertical alignment (the 'valign' property of TD elements in HTML, for example).

'center' is the value used when referring to horizontal alignment.

In the end, you're still probably better off putting the align='center' in the TD tags likes the others recommended.

If nothing works for you, post the swapImage(...) code as well.

--Dave
 
Thanks to all of you. You all get a STAR.. The table cell modification worked...

Thanks a million!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top