Pages:1
Continuing the XHTML discussion...(Click here to view the original thread with full colors/images)
Posted by: smeerkat
How to center a <table> in XHTML Strict ?
In XHTML Strict, something like <center><table>...</table></center> or <table align="center">...</table> is forbidden (because of the deprecated <center> tag and the forbidden align="center" in <table> .
With Mozilla you can use the CSS style table { margin-left:auto; margin-right:auto; } but it doesn't work within Microsoft Internet Explorer (MSIE).
The only thing which works both in Mozilla and in MSIE is wrapping the <table> in another <table> (align="center" being allowed within <td> tag) :
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center"><table>...</table></td></tr></table>
It's not so nice but it works !
Posted by: Ritsui
Sorry I missed the last post as it would have been a better place to argue this, but I think not so nice is a bit of an understatement. I am very much against dropping old standards in this particular case. Cleaning up table tags is all well and good, but removing <center> tags makes no sense to me because it assumes and requires an un-needed complexity for the simplest documents.
Why should anyone be required to use tables and/or CSS just to put a single word in the center of the screen? I think deprecation should occur not when a standards group enforces it, but rather when actual usage dictates that something is no longer required. That may not be a good way to create elegant specifications, but it does let page authors just author without needing to be anal about their code.
Posted by: smeerkat
I think that the motivation behind XHTML is to separate data from presentation (styles). So you are right that it takes more words to achieve the same effect, but the ends justifies the means.
|
|