Paul's Programming Notes     Archive     Feed     Github

"margin-left: auto;" and "margin-right: auto;" Not Working In IE8

To get something centered within a div in IE8, it requires doing something unusual. I wasn't able to get the "display: block;" trick working. But this worked:

#super-wrap { position: absolute; width: 100%; text-align: center; } 
#page-wrap { position: relative; width: 970px; margin: auto auto;  }

I had to do this to get the InfoGrid (http://css-tricks.com/examples/InfoGrid/) to center in IE8. The div with the ID of #page-wrap already exists, but the super-wrap div needs to be created outside of the page-wrap div.