Valid Code (PAG-WEB-001)

Write valid HTML or at least well-formed code

Document structure and semantics are important to ensuring assistive technology (AT) properly parses code so it can communicate correct information to users. Using well-formed HTML is the first step towards ensuring the accessibility of a web page or application for AT users.

Requirements

Valid Code (PAG-WEB-001-01)

An automated HTML validation tool does not return any issues related to incomplete start and end tags, improperly nested elements, or duplicate IDs and/or attributes.


Test Procedures

HTML Validator (PAG-WEB-001-01-T)

  1. Open About the Nu HTML Checker <https://validator.w3.org/nu/about.html> in a new browser window.
  2. Add these two bookmarklets to your browser bookmarks:
    1. Check serialized DOM of current page: grabs the serialized DOM of whatever page you’re currently browsing and sends it to the checker
    2. Check for WCAG 2.0 parsing compliance: filters checker results to just show messages relevant to requirements in the WCAG 2.1 spec (Mouse users can simply drag the corresponding links from the page to the browser bookmarks bar. Keyboard users can follow these instructions.)
  3. Run the first bookmarklet in the browser tab containing your target page. It will send the page's DOM to the checker and show the results in a new browser tab.
  4. Run the second bookmarklet in the browser tab containing the checker results. It will filter the results to show only WCAG parsing errors.
  5. Examine the filtered results to verify that there are no errors related to:
    1. Missing start or end tags 
    2. Duplicate attributes
    3. Improper nesting of elements

Related Content

WCAG Success Criteria

W3C Techniques

Common Failures

These materials and steps outlined on this website are provided “AS IS” and are intended for illustrative purposes only. They should not be relied upon for marketing, legal, tax, financial, regulatory or other advice. You are responsible for the legal aspects of any implementation of the concepts illustrated herein. Further, Visa neither makes any warranty or representation as to the completeness or accuracy of this information, nor assumes any liability or responsibility that may result from reliance on such information.  You should not act or rely on such content without seeking the advice of a professional.  All brand names, logos and/or trademarks are the property of their respective owners, are used for identification purposes only, and do not necessarily imply product endorsement or affiliation with Visa.