G115: Using semantic elements to mark up structure | WAI | W3C Skip to content

Technique G115:Using semantic elements to mark up structure

About this Technique

This technique relates to 1.3.1: Info and Relationships (Sufficient, together with H49: Using semantic markup to mark emphasized or special text).

This technique applies to markup languages, including HTML.

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: Linking to another page

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

<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: Using cite and blockquote to reference a book and a quotation from it

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.

<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: Using the strong element to emphasize important text

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.

<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: Using the em and strong elements to emphasize text

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

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

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

Related Resources

No endorsement implied.

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.
Back to Top