[thelist] Image Horizontal Alignment with CSS...

Anthony Baratta Anthony at Baratta.com
Fri Dec 5 13:10:31 CST 2003


I've stumbled across a problem implementing horizontal alignment to images 
that are embeded inside a table cell and a div. Here's a code snip:

<table width="300" border="1" cellspacing="0" cellpadding="0">
    <td width="1"><img src="/images/spacer.gif" width="1" height="150"></td>
    <td><div id='UserContentSpace' name='_203'><img height="299" hspace="0"
         src="/images/image.jpg" width="201" align="middle">

FYI - The div is part of our CMS application.

Anyway - left and right work, but middle and absmiddle do not. I've tried a 
few things:

* If I add a class or an ID to the image, I can manipulate the horizontal 
alignment with CSS
	div#UserContentSpace img#Test {display: block; margin: auto;}

	.Test {display: block; margin: auto;}

Either of the above only work with Mozilla. IE ignores it. I can't target 
the table cell itself due to constraints with the CMS application that 
drives this site. I can target the image directly via Class or ID 
attributes and CSS.

I've read the CSS specs at W3.org, played with a couple examples at other 
web sites, and have come away confused. Any clues are appreciated.
Anthony Baratta
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."

More information about the thelist mailing list