- What Is HTML?
- Enter XML
- Transitioning from HTML to XHTML
- Choosing Between XML, HTML, and XHTML
- About this Article
Transitioning from HTML to XHTML
Because XHTML is the current recommended markup language of the W3C, many authors are beginning to transition their practices to XHTML. However, XHTML is not always the best choice because it is often stricter than HTML 4. So it takes experience and understanding to be able to choose which markup methodology you're going to use.
To balance shifting trends in convention, and approach the demand for better standardization across browsers, HTML 4 emerged with some potent rules. Your challenge, as a developer, is that these rules, in their strictest incarnation, don't always work in cross-browser/cross-platform design, and they are often not backward compatible.
To address these issues, HTML 4 has built-in accommodations for them. Interestingly, it's this flexibility within HTML 4 that is the least understood and yet it's a seminal aspect of the HTML 4 standard.
These accommodations are referred to as interpretations of HTML 4, and they fall into three types:
Strict HTML 4. This is the most pure of HTML 4 interpretations. Anything deprecated (condemned) or made obsolete in this version of the language is not ever used. The strict interpretation is also the most optimistic version of HTML 4 because many of its rules are far ahead of the stability user agents, or browsers, offer.
Transitional or "loose" HTML 4. By combining aspects of the prior version of HTML (HTML 3.2) with elements from the strict HTML 4 standard, a more realistic, useable version of the language emerges. This is where you will find the most backward compatibility for most public and contemporary web-site designs.
Frameset HTML 4. This includes all the information within the transitional version, plus the newly adopted frame-based elements, such as FRAME, FRAMESET, NOFRAMES, and IFRAME. The frameset interpretation exists to confirm the standardization of frames within HTML and offer a regulated method of using them.
The standard expects that you will insert the appropriate document version and the document type definition (DTD) information identifying the standard to which the document conforms.
Along with these interpretations, HTML 4 encourages authors to adopt three concepts that help ameliorate problems and concerns with the language's past (and often current) use:
Separate document structure from presentation and style. Much of HTML 4 is focused on setting aside any element from prior language versions used for presentation or style of information. Instead, style sheets for presentation and design are typically recommended.
Think carefully about accessibility and internationalization. Because HTML was originally built for all people to access documents, including those on a variety of platforms, using different languages, different user agents, and with a special concern for those having physical impairments, the standard asks that you keep these issues in mind when authoring code. A good example of this is adding alt attribute descriptions to img tags, helping visually impaired users to better understand web documents.
Make documents load more quickly through careful table design. HTML 4 has several element additions that help tables render incrementally. In fact, HTML 4 highly encourages developers to move away from using tables for an underlying grid system and to use style sheet positioning instead. Of course, choosing to use style positioning over table grid systems is difficult to achieve. Style-sheet positioning is highly unstable, unreliable, and has no built-in backward compatibility.
XHTML 1.0 especially builds very heavily on these foundations.