When promoting web standards, standardistas often talk about X HTML as being more strict than HTML. In a sense it is, since it requires that all elements are properly closed and that attribute values are quoted. But there are two flavours of X HTML 1.0 (three if you count the Frameset DOCTYPE, which is outside the scope of this article), defined by the Transitional and Strict DOCTYPE. And HTML 4.01 also comes in those flavours.
The names reveal what they are about: Transitional DOCTYPE s are meant for those making the transition from older markup to modern ways. Strict DOCTYPE s are actually the default – the way HTML 4.01 and X HTML 1.0 were constructed to be used.
A Transitional�DOCTYPE�may be used when you have a lot of legacy markup that cannot easily be converted to comply with a Strict�DOCTYPE. But Strict is what you should be aiming for. It encourages, and in some cases enforces, the separation of structure and presentation, moving the presentational aspects from markup to�CSS. From the�HTML�4 Document Type Definition:
This is�HTML�4.01 Strict�DTD, which excludes the presentation attributes and elements that W3C expects to phase out as support for style sheets matures. Authors should use the Strict�DTD�when possible, but may use the TransitionalDTD�when support for presentation attribute and elements is required.
An additional benefit of using a Strict�DOCTYPE�is that doing so will ensure that browsers use their strictest, most standards compliant rendering modes.
Tommy Olsson provides a good summary of the benefits of using Strict over Transitional in�Ten questions for Tommy Olsson�at Web Standards Group:
In my opinion, using a Strict�DTD, either�HTML�4.01 Strict or�XHTML�1.0 Strict, is far more important for the quality of the future web than whether or not there is an X in front of the name. The Strict�DTD�promotes a separation of structure and presentation, which makes a site so much easier to maintain.
For those looking to start using web standards and valid, semantic markup, it is important to understand the difference between Transitional and Strict�DOCTYPEs. For complete listings of the differences between Transitional and Strict�DOCTYPEs, see�XHTML: Differences between Strict & Transitional,�Comparison of Strict and Transitional�XHTML, and�XHTML1.0 Element Attributes by�DTD.
Some of the differences are more likely than others to cause problems for developers moving from a Transitional�DOCTYPE�to a Strict one, and I’d like to mention a few of those.
applet,�basefont,�center,�dir,�font,�iframe,�isindex,�menu,�noframes,�s,�strike,�u.
Attribute�alink�is forbidden on�body.
Attribute�background�is forbidden on�body.
Attribute�bgcolor�is forbidden on�body,�table,�td,�th,�tr.
Attribute�border�is forbidden on�img,�object, it can be used on�table.
Attribute�clear�is forbidden on�br.
Attribute�language�is forbidden on�script.
Attribute�link�is forbidden on�body.
Attribute�name�is forbidden on�form,�img, it can be used on�a,�button,�input,�map,�meta,�object,�param,�select,�textarea.
Attribute�noshade�is forbidden on�hr.
Attribute�nowrap�is forbidden on�td,�th.
Attribute�start�is forbidden on�ol.
Attribute�target�is forbidden on�a,�area,�base,�form,�link.
Attribute�text�is forbidden on�body.
Attribute�type�is forbidden on�li,�ol,�ul, it can be used on�a,�button,�input,�link,�object,�param,�script,�style.
Attribute�value�is forbidden on�li, it can be used on�button,�input,�option,�param.
Attribute�vlink�is forbidden on�body.
#PCDATA�cannot be a child of�blockquote,�body,�form,�noscript.
Element�a�cannot be a child of�blockquote,�body,�form,�noscript.
Element�abbr�cannot be a child of�blockquote,�body,�form,�noscript.
Element�acronym�cannot be a child of�blockquote,�body,�form,�noscript.
Element�b�cannot be a child of�blockquote,�body,�form,�noscript.
Element�bdo�cannot be a child of�blockquote,�body,�form,�noscript.
Element�big�cannot be a child of�blockquote,�body,�form,�noscript.
Element�br�cannot be a child of�blockquote,�body,�form,�noscript.
Element�button�cannot be a child of�blockquote,�body,�form,�noscript.
Element�cite�cannot be a child of�blockquote,�body,�form,�noscript.
Element�code�cannot be a child of�blockquote,�body,�form,�noscript.
Element�dfn�cannot be a child of�blockquote,�body,�form,�noscript.
Element�em�cannot be a child of�blockquote,�body,�form,�noscript.
Element�i�cannot be a child of�blockquote,�body,�form,�noscript.
Element�img�cannot be a child of�blockquote,�body,�form,�noscript.
Element�input�cannot be a child of�blockquote,�body,�form,�noscript.
Element�kbd�cannot be a child of�blockquote,�body,�form,�noscript.
Element�label�cannot be a child of�blockquote,�body,�form,�noscript.
Element�map�cannot be a child of�blockquote,�body,�form,�noscript.
Element�object�cannot be a child of�blockquote,�body,�form,�noscript.
Element�q�cannot be a child of�blockquote,�body,�form,�noscript.
Element�samp�cannot be a child of�blockquote,�body,�form,�noscript.
Element�select�cannot be a child of�blockquote,�body,�form,�noscript.
Element�small�cannot be a child of�blockquote,�body,�form,�noscript.
Element�span�cannot be a child of�blockquote,�body,�form,�noscript.
Element�strong�cannot be a child of�blockquote,�body,�form,�noscript.
Element�sub�cannot be a child of�blockquote,�body,�form,�noscript.
Element�sup�cannot be a child of�blockquote,�body,�form,�noscript.
Element�textarea�cannot be a child of�blockquote,�body,�form,�noscript.
Element�tt�cannot be a child of blockquote, body, form, noscript.
Element�var�cannot be a child of�blockquote,�body,�form,noscript.
Element�blockquote�cannot contain #PCDATA, a,abbr, acronym, b, bdo, big, br,
|
My Blog Title
|