Rules for valid XHTML Strict
Posted Aug 2, 2004 at 12:24 AM
At its foundation, XHTML is simply HTML refactored in an XML framework. This post discusses the rules that this refactoring requires all valid XHTML documents to abide by.
XHTML is XML
This means that all XHTML documents must comply with the following rules that are inherited from XML:
- All XHTML attributes must be quoted.
- All XHTML tags and elements must be properly closed. An XHTML element that contains no child elements must be self closing (e.g. <hr /> instead of <hr>).
- Attribute minimization is not allowed. For example, <option selected> is a valid HTML tag, but is not valid in XHTML. The correct way to reflect minimized attributes is to use the attribute name as the value, such as <option selected="selected">.
- Structure must be perfectly nested. For example, instead of this: <div><span>foo</div></span>, do this: <div><span>foo</span></div> instead.
XML (and XHTML) must be validateable
Additionally, like all good XML, XHTML must be able to be validated against a schema or definition of its rules. This results in the following additional requirements:
- XHTML element and attribute names must be specified in lowercase, due to the case-sensitive nature of XML, schemas and DTD’s.
- Deprecated tags (such as <center>) and deprecated attributes (such as bgcolor) that are not defined in the schema are not supported.
- The hierarchy of parent/child elements must be written correctly, because they are enforced. For example, an inline element (such as a <span>) cannot contain a block element (such as a <div>).
XHTML is the core to standards-based development
Standards-based development focuses chiefly on three things:
- XHTML, the markup of our dynamic, non-cacheable pages that our servers generate per request.
- CSS, the separate, cacheable files that provide our recommended layout and styling for the content and services delivered in the XHTML.
- Behavior, usually implemented in separate, cacheable files that enhance the content and services by leveraging programmatic capabilities of some browsers/devices.
About this page
This page contains a single post from Daniel Boerner's blog, of which Boot Camp + Windows Vista = no more Airport Extreme reboots is the latest post.
Are there more posts like this one?
Possibly. Within this blog, this post is categorized under webdev and it was posted on August 2, 2004. Those would be good places to start looking for related posts.
Next post (newer)
HTML tags deprecated in XHTML Strict
This post is closed to new comments.