[thelist] Centering a div with CSS
Michael Barrett
thelist at lists.evolt.org
Thu Jun 13 18:36:00 2002
> Try left:auto; right:auto;
If the DIV is not absolutely positioned...
The technically correct thing to do is:
margin-left: auto;
margin-right: auto;
As this should create equal margins on either side, centering the element
horizontally.
Not all browsers will comply with this however (Windows IE in particular)
You can style the containing element (the body, another DIV, whatever) of
the DIV you want to center like so:
text-align: center;
Which should center the DIV in Win IE
--
Michael Barrett
-O^O-
-
mbarrett@triad.rr.com