Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

218 CHAPTER 5 More HTML5


Using the <dfn> element to define a term
The <dfn> element denotes the definition of a term, also known as the defining instance of
the term. The <dfn> element can contain a title attribute, which, if it exists, must contain the
term being defined.
If the <dfn> element contains exactly one element child node and no child text nodes, and
that child element is an <abbr> element with a title attribute, that attribute is the term being
defined.
Consider the following example that uses the <dfn> element with the <abbr> element to
provide a definition.
<p>
A motor vehicle has a <dfn id="vin">
<abbr title="Vehicle Identification Number">VIN</abbr></dfn>
that is unique. Over the years, the
<abbr title="Vehicle Identification Number">VIN</abbr>
has had different formats,
based on the vehicle manufacturer.
</p>
<p>
In the United States, the <a href="#vin">
<abbr title="Vehicle Identification Number">VIN</abbr></a>
was standardized to a 17 character format where
the 10th character of the
<abbr title="Vehicle Identification Number">VIN</abbr>
represents the year of the vehicle.
</p>

In this example, the <dfn> element is used once where the first instance of VIN is being
presented. Inside the <dfn> element is an <abbr> element, which provides the meaning
of VIN in its title attribute. The default style of the <dfn> element is italic text, as shown in
Figure 5-4. The use of the <a> element provides a hyperlink to the definition.

FIGURE 5-4 he <T dfn> element italicizing its text by default
Free download pdf