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.
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.
HTML Validator (PAG-WEB-001-01-T)
- Open About the Nu HTML Checker <https://validator.w3.org/nu/about.html> in a new browser window.
- Add these two bookmarklets to your browser bookmarks:
- Check serialized DOM of current page: grabs the serialized DOM of whatever page you’re currently browsing and sends it to the checker
- 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.)
- 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.
- Run the second bookmarklet in the browser tab containing the checker results. It will filter the results to show only WCAG parsing errors.
- Examine the filtered results to verify that there are no errors related to:
- Missing start or end tags
- Duplicate attributes
- Improper nesting of elements