XHTML Strict, Transitional, and Frameset

There are three current flavors of both XHTML 1.0 and HTML 4: strict, transitional, and frameset. These different XHTML compatibility levels were created to help separate a Web page's structure from formatting - essentially, the W3C has been earmarking some elements for eventual removal from the specifications. XHTML strict is characterized by its prohibition of these so-called depricated tags. Both transitional and frameset compatibility levels allow for depricated tags, with their only difference being that the latter allows for the use of HTML frames.

XHTML Doctype Declarations

An XHTML doctype declaration is used to officially state which version and XHTML compatibility level that you're using in your Webpage. Once you have included an XHTML doctype declaration at the top of your Webpage, you can use an XHTML validator to determine if the code used in your page actually conforms to the rules outlined by the version and compatibility level that you selected. Here's what a DOCTYPE declaration for XHTML 1.1 transitional looks like:

Code Sample

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Code Sample

Similarly, an XHTML strict DOCTYPE declaration is shown here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Finally, an XHTML frameset DOCTYPE declaration is shown here:

Code Sample

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

One of the above example XHTML 1.0 doctype declarations start your XHTML pages - We'll cover this in more detail in the XHTML Example of the next section.

Why use XHTML DOCTYPE Declarations?

In the early days of the Web (late 90's, early 2000's), each Web browser had its own way of interpreting HTML and CSS. Web designers often resorted to complicated workarounds (essentially hacks) that depended on a browser's buggy behavior in order to create a desired effect on a Web page. These days, as Web standards and browsers have become more mature, most Web browsers fully support the XHTML standard, and designers no longer need to rely on these workarounds, rather they can create new Web pages which only use XHTML compliant syntax and expect a certain level of browser compatibility.

But what about the billions of existing pages which were designed for misbehaving browsers? If they were to properly render pages according to the standards, they would ruin their bug-dependent design. Thus, Microsoft Internet Explorer and Netscape 6 revert to their old "quirky" (i.e. busted) way of rendering pages, unless they adhere to the XHTML or HTML 4 standards — and the way to tell the browser that you intended the design of a page to be compliant with new standards is by including an XHMTL DOCTYPE declaration at the top of an HTML page! XHTML DOCTYPE declarations allow you to write new, standards-based pages without having to fix all of your old Web content.

Advertisement

Inquire about advertising on Web Head Start.

XHTML Topics

  1. Why XHTML?
  2. XHTML Basics
  3. XHTML Example
  4. Declaring a DocType
  5. XHTML Encoding
  6. XHTML Headers
  7. XHTML Comments
  8. XHTML Divisions
  9. XHTML Span
  10. XHTML 1.1
  11. XHTML Guidelines
  12. XHTML FAQ