Technique H74:Ensuring that opening and closing tags are used according to specification
About this Technique
This technique relates to 4.1.1: Parsing (Sufficient, together with H93: Ensuring that id attributes are unique on a Web page and H94: Ensuring that elements do not contain duplicate attributes when used for ensuring that Web pages can be parsed).
This technique applies to HTML.
Description
The objective of this technique is to avoid key errors that are known to cause problems for assistive technologies when they are trying to parse content which involve having opening and closing tags that are not used according to specification. There are several validators that a developer can use: validation reports generally mention these types of errors. This technique deals only with errors related to incorrectly formed opening and closing tags. The document type declaration is not strictly necessary for this type of evaluation, but specifying the document type declaration makes it easier to use a validator.
Examples
Example 1: HTML
HTML pages include a document type declaration (sometimes referred to as !DOCTYPE
declaration). A developer can use offline or online validators (see the Resources section) to check that all id
attribute values are unique and that opening and closing tags are used according to the specification.
Related Resources
No endorsement implied.
- Do not forget to add a doctype by the W3C Quality Assurance Initiative.
- Recommended DTDs to use in your Web document.
-
HTML - The
doctype
. - Validating Web pages.
- The W3C's Nu HTML Checker.
Tests
Procedure
- Check that there are closing tags for all elements with required closing tags.
- Check that there are no closing tags for all elements where closing tags are forbidden.
- Check that opening and closing tags for all elements are correctly nested.
Expected Results
Steps #1, #2, and #3 are true.