HTML and CSS Reference
In-Depth Information
Since the additional nesting restrictions are defined by XHTML specifications, some nesting violations are not
recognized by validators in XHTML documents, while such errors can be clearly identified in HTML.
Unlike in HTML, texts cannot be provided directly in the XHTML body without wrapping them in container
elements (such as p ). Omitting containers in XHTML results in the “character data is not allowed here” error message
in the W3C Markup Validator (see Chapter 14).
Invalid Characters
Web documents containing non-Latin characters or special characters such as the copyright sign ( © ) or the registered
trademark sign ( ® ), and older HTML documents, especially the ones from the late 1990s and early 2000s, often contain
character entities. While eliminating most character entities is recommended in HTML, it is mandatory in XHTML.
The best practice is to type in the characters directly in the UTF-8 encoded XHTML markup.
Dashes Are Allowed for Comments Only
In XHTML, double dashes are allowed only at the beginning and end of comments (Listing 3-24).
Listing 3-24. A Comment in XHTML
<!-- Comment -->
Avoid Using Deprecated Elements
While a large set of HTML elements can be used in certain XHTML versions and variants as well, the blackface ,
blockquote , embed , layer , noembed , and shadow deprecated elements are not allowed in XHTML 1.0 Strict, only in
XHTML 1.0 Transitional and XHTML 1.0 Frameset. These elements should be replaced by style sheets except embed
and noembed whose contents can be provided with object . (Table 3-5 ).
Table 3-5. Elements Not Allowed in XHTML 1.0 Strict Must Be Avoided
Deprecated in Favor of
Style sheets
Style sheets
Style sheets
input element, CGI forms
ul , nl
Style sheets
Style sheets
In XHTML 1.0 Strict, XHTML 1.1, and XHTML5, the ul element should be used instead of the menu element.
XHTML2 introduced the nl element for menus, which is not supported in any other markup language.
Search WWH ::

Custom Search