In content implemented using markup languages, elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features.


Rationale

In order for user agents, such as screen readers, to accurately interpret content, the Web site must use correct markup. If the markup of the content is ambiguous, then it may be interpreted differently by different screen readers and the content will not be accessible.

Because there are industry standards for the markup languages used on the Web, such as HTML and XHTML, many Web checking tools can automatically verify that Web pages follow standard markup guidelines. This makes it easier to identify and correct potential parsing problems.

Required development and unit test techniques


To comply with this checkpoint, you must meet at least one of the following techniques. These techniques are defined in WCAG 2.0 Level A Success Criterion 4.1.1 (link resides outside of ibm.com).

  1. Parsed: Ensure that Web pages can be parsed unambiguously.
  2. Validate: Validate Web pages.
  3. Conform: Fully conform to specifications.

Note: The examples presented in the techniques are not exhaustive. They are meant to illustrate the spirit of this checkpoint.

General examples

For techniques that have no technology-specific examples, refer to the HTML example section for guidance.

  1. Parsed: Ensure that Web pages can be parsed unambiguously.

    There are no general examples for implementing this technique. Use the HTML examples as a guide.

  2. Validate: Validate Web pages.

    Web checking tools can verify that a Web page validates against HTML standards for valid markup. Using correct markup helps ensure that the content will be available to assistive technologies.

    To comply with this technique, you must implement at least one of the following examples.

    General example 1

    Use a Web syntax analyzer to validate the Web page against HTML coding standards.

    General example 2

    Use a Web syntax analyzer to validate the Web page against XHTML coding standards.

    For additional information, refer to the WCAG 2.0 examples for validating Web pages (link resides outside of ibm.com).

    Required unit tests for general development technique 2

    Refer to the required unit tests for general development techniques 2 and 3.

  3. Conform: Fully conform to specifications.

    To comply with this technique, you must implement the following example.

    General example 3

    When markup languages are used in a way that fully conforms to their specifications, all of the requirements for this checkpoint are met. Therefore, while this technique is not always required, it is a best practice and, if met, is one way to satisfy this checkpoint.

    To verify that your pages fully conform to specifications, you should run your code through an automated validator and ensure that all specification errors are corrected.

    For additional information, refer to the WCAG 2.0 examples for using HTML according to spec (link resides outside of ibm.com).

    Required unit tests for general development techniques 2 and 3

    Perform the following unit tests:

    • Use a Web page validator and verify that all technologies are used on the page according to specification.
    • For each HTML or XHTML page, verify that elements, attributes, and values are used in the manner prescribed by the relevant specification.

    Note: You can use a Web validation tool to validate your HTML, XHTML. Web validation tools can identify errors, but they cannot identify all cases in which content fails. To fully conform to a specification, manual judgment is usually required.

 

HTML examples

For techniques that have no technology-specific examples, refer to the general example section for guidance.

  1. Parsed: Ensure that Web pages can be parsed unambiguously.

    To comply with this technique, you must implement at least one of the following examples.

    HTML example 1

    Ensure that opening and closing tags are used according to specification AND that id attributes are unique for a page AND that elements do not contain duplicate attributes.

    By using correct markup, you ensure that assistive technology can accurately parse the content. The following example shows the correct use of unique id attributes in table markup. Note that closing tags are also added for all elements.

    <tr>
    <th id="cp1"><a name="Checkpoint1">1</a></th>
    <td headers="cp1">Images and animations. Use the alt attribute to provide text equivalents for images.</td>
    </tr>
    <tr>
    <th id="cp2"><a name="checkpoint2">2</a></th>
    <td headers="cp2">Image maps. Use client-side image maps and alternative text for image map hot spots.</td>
    </tr>

    For additional information, refer to the WCAG 2.0 examples for ensuring that id attributes are unique on a Web page (link resides outside of ibm.com).

    The following example shows the same code sample before and after closing tags were added. Closing tags must be used so that the code can be parsed accurately.

    <img id="logo" src="mylogo.jpg" alt="My logo"> - incorrect
    <img id="logo" src="mylogo.jpg" alt="My logo" /> - correct

    For additional information, refer to the WCAG 2.0 examples for ensuring that opening and closing tags are used according to specification (link resides outside of ibm.com).

    Use attributes only once on each element. For additional information, refer to the WCAG 2.0 examples of ensuring that elements do not contain duplicate attributes (link resides outside of ibm.com).

    HTML example 2

    Ensure that Web pages are well-formed. The W3C Spec for XML 1.1 (link resides outside of ibm.com) defines the criteria for well-formed XML content and a conforming XML parser can validate XML content against that criteria.

    Use a valid doctype statement to enable the validating XML parser to check content against the correct schema.

    For example:

    HTML 4 example

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

    HTML5 example

    <!DOCTYPE html>

    For additional information, refer to the WCAG 2.0 examples for ensuring that Web pages are well-formed (link resides outside of ibm.com).

    HTML example 3

    Ensure that Accesskey values are unique on the page.
    For additional information, refer to the WCAG 2.0 Failure of Success Criterion due to insufficient information in the DOM to determine one-to-one relationships (link resides outside of ibm.com).

    Required unit tests for HTML development technique 1

    Either verify the content using a validating XML parser, or manually perform the following unit tests:

    • Verify that opening and closing tags are used according to the specification.
    • Verify that each attribute does not occur more than once on any element.
  2. Validate: Validate Web pages.

    There are no examples for implementing this technique in HTML. Use the general examples as a guide.

  3. Conform: Fully conform to specifications.

    There are no examples for implementing this technique in HTML. Use the general examples as a guide.

 

Recommended development techniques

Although you do not have to implement the recommended techniques in order to comply with this checkpoint, you should review them because they can improve the accessibility and usability of the application.

Recommended example 1 - Validating Web pages using the WAI-ARIA DTD

Applications that contain WAI-ARIA markup may be validated against the HTML 4.01 Transitional DTD by including the following doctype statement:

The WAI-ARIA DTD specified in the above doctype extends the XHTML 1.1 DTD by including support for WAI-ARIA attributes and extending the use of tabindex on a broader set of elements.

Note however, the WAI-ARIA DTD is not an official W3C DTD and should be considered a derivative work of HTML 4.01.

WAI-ARIA is being incorporated into the HTML 5 specification, and official support for WAI-ARIA in HTML will be provided in that specification. The WAI-ARIA DTD is provided as a bridging solution for applications requiring DTD validation.

More information on the WAI-ARIA DTD can be found on the W3C Web site.


©2013 IBM Corporation

Last updated January 1, 2013.

W3C Recommendation 11 December 2008: http://www.w3.org/TR/WCAG20/ (link resides outside of ibm.com)
Consortium for Informatics and Mathematics, Keio University), All Rights Reserved.