These days many websites prefer to have fixed width body which is horizontally centered, and if you also want to create website like that, you would probably use "margin:auto;" style in your main container div inside body. This will work fine in most of the CSS2 and CSS3 compliant browsers(Firefox, Chrome) but in IE this page would not be centered!
Click here to see the Demo in IE.
You might be thinking "WTF is wrong with IE??".
Well there are many things which are wrong with IE, and this is just one of those.
Here is a workaround to fix this issue, use "text-align:center;" in BODY to align 'block' elements like "DIV". YUI also does the same in their reset css.
Click here to see the Demo with IE fix.
By now you must have noticed that we have to fix side effect of text-align when we use this approach, if you haven't noticed that in Demo, then again have a look at it.

Related Posts


Post a Comment