U.S. Department of Energy - Energy Efficiency and Renewable Energy

Communication Standards and Guidelines

HTML Syntax

EERE has established the following HTML syntax standards to ensure that our Web sites are accessible to as many users as possible.

  • EERE HTML syntax follows HTML 4.01 Transitional Standards or higher.

  • Special characters should be encoded using character entity references. See the Web Standards Project for more information.

  • All HTML document syntax must be validated by the W3C's validator. The documents must be made as compliant as is possible with regard to EERE's standard browser set and other template requirements.

What is a standards compliant document?

A standards compliant document is one that can be validated in the World Wide Web Consortium (W3C) validator and not return errors. The W3C is the international industry consortium that develops standards for technologies for the Web. All browser makers and programmers rely on these standards to develop applications. Their validation tool is nonproprietary and free. Anyone can access it with a Web connection. The source code can also be downloaded.

Why is following standards important?

Ignoring standards can restrict access to your site.

Browsers such as Internet Explorer and Netscape for your desktop computer include a great deal of extra code to deal with syntax errors. They look at invalid code and make a guess as to how it should be displayed. When HTML code is well-formed, it eliminates ambiguity in parsing by browsers, thereby reducing the rendering differences between them. More to the point, PDAs, cell phones, and other devices do not have this extra code to handle errors gracefully and will not render poorly formed code correctly or at all.

Standards compliant code will reduce the need to test in multiple browsers.

The newer browsers are more and more standards compatible. If the code is clean, you know it will work in all standards compliant browsers.

Standards compliant code is faster.

Properly written HTML will render better, render on more browsers, and render faster than HTML with errors.

Complying with Web standards can give your Web pages greater visibility in Web searches.

Some search engines cannot properly catalog or index a site that has HTML errors. The structural information present in compliant documents makes it easy for search engines to access and evaluate the information in those documents, and they get indexed more accurately.

Using correct syntax paves the way to using XHTML, an XML compatible version of HTML.

Using XHTML will enable web authors to leverage tools from the XML world, such as XSLT, to easily manipulate XML data. XML is very strict in regard to syntax and will not work correctly with malformed code.

Standardized code makes it easier for Web developers to assuming management of existing sites written by other developers.

Ensuring that code validates to the W3C standards is a very effective way to ensure measurable quality of the final product, the W3C being an impartial judge. Because standards are very well documented, another person taking over some standard-compliant code can hit the ground running and will not need to become familiar with the previous developer's coding practices.

Currently, the EERE template does return one error regarding the search box referencing a non-existent ID. The search box is dynamically sized using JavaScript. The code actually lives in a separate file so that all pages can use it and updates only need to be made in one place. The validator doesn't see this code even though the browser processes it.

The error displays as follows:

  • reference to non-existent ID "SEARCH"
    ...ze: 1px; color: 000066;"><label for="search">Search</label></span><br>

General

  • Use style sheets.
  • Do not use deprecated tags that are being phased out, such as <font> and <center>.
  • Be sure all documents are well-formed (proper nesting).
  • Lowercase all elements and attributes (e.g., tags).
  • Close all nonempty elements (<p> </p>).
  • Quote all attributes (<p align="center">...</p>).