--- obsoleteMessage: | This technique relates to 4.1.1: Parsing, which was removed as of WCAG 2.2. obsoleteSince: 22 ---

# Ensuring that opening and closing tags are used according to specification

ID: H74

Technology: html

Type: Technique

## When to Use

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

### 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.

## Tests

### Procedure

1. Check that there are closing tags for all elements with required closing tags.
2. Check that there are no closing tags for all elements where closing tags are forbidden.
3. Check that opening and closing tags for all elements are correctly nested.

### Expected Results

Steps #1, #2, and #3 are true.

## Related Techniques

## Resources

- 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.