Yale University Library

 

Library Access Integration Services

Quick Links
Some Tips on Converting HTML to XHTML
  • Don't forget to declare the DOCTYPE, namespace, content type
  • Inline tags (<span>, <a>, <img>) can't contain block level tags (<p>, <div>)
  • Use the id instead of the name attribute. If you want your page to be fully compatible, include both for older browsers
    <a href="#section">link</a><p id="section" name="section"></p>
  • Add the alt attribute to your image tags : <img src="header.gif" alt="" /> Note alttags are required for web-site accessbility
  • Use entity values, e.g. &amp; &lt; &gt; for &, <, > when writing content and URLs, for example:
    WW&amp;DCS instead of WW&DCS
    < a href="a.asp?page=2&amp;style=blue"> , not <a href="a.asp?page=2&style=blue">
  • Attributes must have values and be quoted.
    <option value="xhtml" selected="selected">XHTML</option>
  • Avoid using deprecated HTML elements such as <font> tags, prefer <strong> to <b>, <em> to <i> . Deprecated elements are tags that the W3C no longer wishes HTML designers to use. They have been replaced with other tags.
Conversion Tools:
  • If you use a text editor, Find and Replace is a quick way to convert and replace code
  • Feed your existing HTML documents into an XHTML converter, such as Infohound's XHTML Tidy
  • If you have an older version of Dreamweaver (version 4 or older), you can "update" Dreamweaver to write valid XHTML with the following: You can change the default template
    Go to C:\Program Files\Macromedia\Dreamweaver ver\Configuration\Templates\Default.html, and change the DTD to: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
    You can also add other settings, such as:
    <meta http-equiv="Content-Type" content="text/html; charset=">
    <link rel="stylesheet" type="text/css" href="http://www.library.yale.edu/wsg/cssprint/print.css" media="print" />
  • Modifying Dreamweaver to Produce Valid XHTML (See NYPL site for Detail)
    Go to C:\Program Files\Macromedia\Dreamweaver ver\Configuration\Objects\ open
    • Common\Image.js: modify: "return '<img src="' + newURL + '">';" to this: "return '<img src="' + newURL + '" alt=""/>';".
    • Common\HR.htm : modify <hr> to <hr />
    • Characters\Line Break.htm: modify <br> to <br />
    • Alternatively, you can look into purchasing Dreamweaver 8 which has full XHTML support
Using the Library Template

Quick Links

What is XHTML?

XHTML Rules

Tips and Tools

Using the Library Template

Updating Existing Page

How to Validate an Existing Page

References