Center align a div in IE 8

Usually when I want to center align a div on a page, I use margin:auto auto and set my width to a specific width, like 940px in my stylesheet. But, this does NOT work in IE 8. So to make that work, use

width:940px
height:100%
position:absolute
left:50% (to tell that your div should start in the middle of the page)
margin-left:-490px (half of your div size)

Thanks to this site

IE 8 and compatibility view

I installed Internet Explorer 8 yesterday – yeah a bit late, I know 🙂 Entered a customers site that I have built on MOSS and paniced a little when I found out that the drop down menus where… white!! No, not again. Not another strange issue with my customized drop down menu… the last time I had issues with the menu was in the Safari browser and then I had to do this. …. Hm, then I thought about a setting that I had checked when installing IE 8 and that was the compatibility view setting. That if a site has been built for older versions then you could enable this view to make the site look better (well, in my case – worse!). So by simply disable the compatibility view, the drop down menus looked alright again. Phew….

This is how the drop down menu looked like while the browser had Compatibility View enabled:

There is a new button to the left of “Refresh” in your address bar when you enable this view:

When you enable it, it gives you the following message:

I simply clicked on the button for Compatibility View and the menu looked normal again:

So I right clicked on the toolbar in IE 8 and disabled the compatibility view.