Got a fixed width website and can’t get it to centrally align in the window in Internet Explorer? Or you can get it to centrally align in IE but not in any other browser? Fear not, it’s not your fault! Unfortunately, the correct way of centrally aligning content through CSS doesn’t actually work in IE:
margin: 0 auto
The second command,
margin: 0 auto, basically gives our containing element an automatic margin on the left and right, thereby positioning the containing element in the centre of the browser window.
IE however, will need slightly different commands to make this work:
margin: 0 auto;
This will then centrally align the container in IE too. To prevent the text from centrally aligning too, we insert
text-align: left into the container div.