Friday, August 3, 2007
Differences from HTML
The changes from HTML to first-generation XHTML 1.0 are minor and are mainly to achieve conformance with XML. The most important change is the requirement that the document must be well-formed and that all elements must be explicitly closed as required in XML. In XML, all element and attribute names are case-sensitive, so the XHTML approach has been to define all tag names to be lowercase. This contrasts with some earlier established traditions which began around the time of HTML 2.0, when many used uppercase tags. In XHTML, all attribute values must be enclosed by quotes (either 'single' or "double" quotes may be used). In contrast, this was sometimes optional in SGML, and hence in HTML, where numeric or boolean attributes can dispense with quotes (quoted attributes are assumed to be strings). All elements must also be explicitly closed, including empty (aka singleton) elements such as img and br. This can be done by adding a closing slash to the start tag. Attribute minimization (e.g., option selected) is also prohibited as the attribute “selected” contains no explicit value; instead, use option selected="selected". HTML elements which are optional in the content model, will not appear in the DOM tree unless they are explicitly specified. For example, an XHTML page must have a body element, and a table will not have a element unless the author specifies one. More differences are detailed in the W3C XHTML 1.0 recommendation. Differences between HTML and XHTML from the (X)HTML5 point of view are detailed on the WHATWG wiki.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment