...

View Full Version : margin:auto not working on ie



esthera
05-07-2007, 07:58 PM
i have css

#main{
width:802px;
margin:auto;
}


in firefox it centers it in the middle as it should
in ie it goes to the left

did I do somethign wrong? isn't margin:auto supposed to work on both

coothead
05-07-2007, 09:27 PM
Hi there esthera,

are you using a DOCTYPE?

coothead

esthera
05-08-2007, 05:04 AM
i'm using

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

felgall
05-08-2007, 07:34 AM
That should centre then provided that there is nothing before the doctype such as a blank line.

koyama
05-08-2007, 10:36 AM
i'm using
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

That should centre then provided that there is nothing before the doctype such as a blank line.
In fact, that is not a good doctype. It triggers quirks mode in all major browsers. Use the chart on the following page to see which layout mode is triggered by various document types:

Activating the Right Layout Mode Using the Doctype Declaration (http://hsivonen.iki.fi/doctype/)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum