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.
ok how is this supposedto mean?
Your designer needs to be aware of this information, if he is not then likely a large number of the visitors to your site are not seeing what you are seeing on your site.
Many of the posts are fairly technical. I can not copy all of the specifications of HTML5, I can however create commentary on them – some are technical some not. This one is technical. If you do not create content for the web and are not concerned about under the hood then don’t be concerned by it …
- The way search engines work is questions based. The new traffic to this site is from these questions, it is to that audience many posts are created (the blog is still in this growth pattern), so it is silly to try to explain why should you care – they landed on the page already caring. The traffic to this post will be limited to those who dig the HTML archives or search on html5 center auto:margin. Much in the same way as xhtml vs html5 which is peeking its head up into recent top posts.
Am I going to make any sales related to this post? No. Am I going to get a link as a reference to this post? Maybe. The new HTML5 specification should address backwards compatibility.
… If you do create content or specifications about what is under the hood? There still exists some cases where Margin:auto does not work while center tag does … it gets much more technical.
What has changed recently is the center tag has been removed from the html specifications. However the need to center content has not been removed from the web.
What is changing is that HTLM5 will create a more beautiful web using an array of new technologies. IE 9 Microsoft’s HTML5 browser is using the slogan “not your father’s browser.” I don’t know if that will catch on and become “not your father’s website.”