Yale University Library

 

Library Access Integration Services

Quick Links
Rules of XHTML

In order for an HTML document to be considered a valid XHTML document, the following rules must be followed

  1. Open with the proper DOCTYPE and Namespace. XHTML documents must begin with tags that tell the browser how to interpret them. All XHTML web pages must begin with the following DOCTYPE declaration:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml/DTD/xhtml-transitional.dtd ">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> 
    OR
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" /> 
    You can simply copy and paste this into every page you create, see reference page for more choice of charset or xml:lang
  2. All tags and attributes must be lowercase e.g. <a href="http://www.library.yale.edu"></a>
  3. Attribute values must be quoted and may not contain a space character. Use an underscore "_" to string words together
  4. All tags must be closed, including "empty tags". For example, a <p> tag must have a corresponding </p> even if it is empty. Likewise, the <br> tag must be closed. It should look like this: <br />. Note the space between the br and the / . This is to prevent confusion in older browsers
  5. Tags must be nested properly. Innermost tags must be closed before outer tags. Incorrect XHTML nesting example:
    <p><strong>hello</p></strong>
    
    Correct XHTML nesting example:
    <p><strong>hello</strong></p>


Tips and Tools
Quick Links

What is XHTML?

XHTML Rules

Tips and Tools

Using the Library Template

Updating Existing Page

How to Validate an Existing Page

References