Techniques for WCAG 2.0

On this page:

-

# G115: Using semantic elements to mark up structure

## Applicability

Markup languages, including HTML 4.01, XHTML 1.x

This technique relates to:

- Success Criterion 1.3.1 (Info and Relationships)
  - How to Meet 1.3.1 (Info and Relationships)
  - Understanding Success Criterion 1.3.1 (Info and Relationships)

## Description

The objective of this technique is to mark up the structure of the Web content using the appropriate semantic elements. In other words, the elements are used according to their meaning, not because of the way they appear visually.

Using the appropriate semantic elements will make sure the structure is available to the user agent. This involves explicitly indicating the role that different units have in understanding the meaning of the content. The nature of a piece of content as a paragraph, header, emphasized text, table, etc. can all be indicated in this way. In some cases, the relationships between units of content should also be indicated, such as between headings and subheadings, or amongst the cells of a table. The user agent can then make the structure perceivable to the user, for example using a different visual presentation for different types of structures or by using a different voice or pitch in an auditory presentation.

In HTML, for example, phrase-level elements such as `em`, `abbr`, and `cite` add semantic information within sentences, marking text for emphasis and identifying abbreviations and citations, respectively. MathML, a markup language designed to maintain important distinctions between structure and presentation in mathematics, includes special "presentation" markup for the complex notations used to represent mathematical ideas as well as "content" (semantic) markup for the mathematical ideas themselves.

## Examples

### Example 1

A paragraph contains a hyperlink to another page. The hyperlink is marked up using the `a` element.

Example Code:

    <p>Do you want to try our new tool yourself? A free
    demonstration version is available in our
    <a href="download.html">download section</a></p>

### Example 2

A page about the history of marriage uses a quotation from Jane Austen's novel, Pride and Prejudice, as an example. The reference to the book is marked up using the `cite` element and the quotation itself is marked up using the `blockquote` element.

Example Code:

    <p>Marriage was considered a logical step for a bachelor,
    as can be seen in the first chapter of the novel
    <cite>Pride and Prejudice</cite>:</p>
    <blockquote>
         <p>It is a truth universally acknowledged, that a single man in
         possession of a good fortune, must be in want of a wife.</p>

         <p>However little known the feelings or views of such a man may
         be on his first entering a neighbourhood, this truth is so well
         fixed in the minds of the surrounding families, that he is considered
         the rightful property of some one or other of their daughters.</p>
    </blockquote>

### Example 3

A car manual explains how to start the engine. The instructions include a warning to make sure the gear is in neutral. The author feels the warning is so important that it should be emphasized so the warning is marked up using the `strong` element.

Example Code:

    <h1>How to start the engine</h1>
    <p>Before starting the engine, <strong>make sure the gear
    is in neutral</strong>. Next, turn the key in the ignition.
    The engine should start.</p>

### Example 4

This example shows how to use the `em` and `strong` elements to emphasize text.

Example Code:

    <p>What she <em>really</em> meant to say was,
    "This is not ok, it is <strong>excellent</strong>!"</p>

### Example 5: Using highlighting and background color to visually and semantically identify important information.

Example Code:

    <style type="text/css">
    .vocab {
    background-color:cyan;
    font-style:normal;
    }
    </style>
    .......
    <p>New vocabulary words are emphasized and highlighted
    with a cyan background</p>
    <p>The <em class="vocab">scathing </em> review of the play
    seemed a bit too harsh. .... </p>

## Resources

Resources are for information purposes only, no endorsement implied.

- HTML 4.01 specification

- HTML 4.01 specification, using phrase elements

- Mathematical Markup Language (MathML) Version 2.0, Second Edition

- Jeffrey Zeldman's book "Designing with Web standards"

- Web Design Group's article "Document style: Use the right tag for the job"

## Related Techniques

- H39: Using caption elements to associate data table captions with data tables
- H42: Using h1-h6 to identify headings
- H44: Using label elements to associate text labels with form controls
- H48: Using ol, ul and dl for lists
- H49: Using semantic markup to mark emphasized or special text
- H51: Using table markup to present tabular information
- H71: Providing a description for groups of form controls using fieldset and legend elements

## Tests

### Procedure

1. Check if there are parts of the content that have a semantic function.

2. For each part that has a semantic function, if corresponding semantic markup exists in the technology, check that the content has been marked up using that semantic markup.

### Expected Results

- Check #2 is true.

- Top
- Contents
- Intro
- Previous: Technique G112
- Next: Technique G117