Mozilla and CSS again

windows

Guest
Hi,

I am using xhtml and css to create a new website.

I have managed to center an image using CSS (position: absolute; left: 50%; margin-left: -310;). The image is 620px wide so this centers the image OK. However, when I try to center a table the same way (in Mozilla) it does not work.

It works in Opera and IE. Is there any other way to get Mozilla to center a table using css??? (while remaining xhtml valid)

Thanks in advance,
Tim Ballard.To center things horizontally in CSS the proper method is to use a fixed width + margin:0 auto;

That will corretly center it in Mozilla as well as Opera. However IE is buggy and will need some kind of workaround.

An easy way is to eg nest your table inside a div with text-align:center
It should have absolutely no effect on the table positioning according to spec, but in buggy IE it does (which in our case is fortunate since it alows us to fix the original bug).

BTW, to center you image with CSS, don't use that intricate positiong stuff.
text-align:center on the parent works just fine in all browsers.
 
Back
Top