HTML5, Center tag, Margin:auto and Internet Explorer

Technically <center> tag is no longer needed in compliant browsers. Style margin:auto with in some cases an element width width:##px centers content and it works well with standards compliant browsers.

It actually does work in IE6 quirks mode with firefox; but does not work in IE6 quirks mode with IE 8.  I recently updated from IE6 to IE8 and I believe IE8 is rendering IE6 quirks mode correctly; thus firefox is incorrectly rending quirks mode by rendering the code correctly.  I don’t do much quirks mode coding so I don’t need to deal with whose quirks mode is correct and how to correct the rendering for all browsers in non-standards modes. But I am going to need to reinstall IE 6.

There are also other rendering engines that I use for testing that do not center with margin:auto. Bottom line though is center tag will RIP next to IE6 and the end of the center tag is a bit premature.

A CSS only center can be achieved all the way back to IE5 using a text-align:center … however content that floats can also complicate the issue. CSS centering also works in strict mode – however ultimately the mode that supports html5 and svg across browsers is what needs to be coded.

Webdevelopment2 has the IE css hack for centering

And just FYI html email will still need center.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: