Center align a container in IE

Today i faced a problem while trying to center align my main div in IE6.

The Problem

#main
{
    width:960px;
    margin:0 auto;
}

This made my div to align itself in the center in firefox and Internet Explorer 7 but, it failed to do the trick for IE6.


After some googling i found following solution on Webcredible.co.uk website. I added my “simple css hack” to make sure it was available only in Internet Explorer.

The Solution

body
{
     _text-align:center;
}
#main
{
     width:960px;
     margin:0 auto;
     _text-align:left;

}

That’s it, we are done this will center align the container in the center of the browser window