HTML5 and CSS3 All-in-One For Dummies
Book image
Explore Book Buy On Amazon

The definition list in HTML5 is very useful, even if it's used infrequently. The definition list was originally designed to format dictionary-style definitions, but it's really useful any time you have name and value pairs.

Definition lists don't use bullets or numbers. Instead, they have two elements. Definition terms are usually words or short phrases. The browser names are defined as definition terms. Definition descriptions are the extended text blocks that contain the actual definition.

The standard layout of definition lists indents each definition description. Of course, you can change the layout to what you want after you understand CSS.

You can use definition lists any time you want a list marked by key terms, rather than bullets or numbers. The definition list can also be useful in other situations, such as forms, figures with captions, and so on.

image0.jpg

Here's the code for basicDL.html:

<!DOCTYPE HTML>
<html lang="en-US">
 <head>
 <meta charset="UTF-8">
 <title>BasicDL.html</title>
 </head>
 <body>
 <h1>Basic Definition List</h1>
 <h2 id="tab1" >Common web Browsers</h2>
 <dl>
  <dt>Mosaic</dt>
  <dd>
  The mother of all modern browsers. The first widely used
  visual browser.
  </dd>
  <dt>Netscape</dt>
  <dd>
  The commercial successor to Mosaic. Widely popular, but
  eventually eclipsed by Internet Explorer
  </dd>
  <dt>IE</dt>
  <dd>
  Microsoft's entry into the browser market, and a dominant
  player.
  </dd>
  <dt>Firefox</dt>
  <dd>
  An open-source browser that has shaken up the world.
  </dd>
 </dl>
 </body>
</html>

As you can see, the definition list uses three tag pairs:

  • defines the entire list.

  • defines each definition term.

  • defines the definition data.

Definition lists aren't used often, but they can be extremely useful. Any time you have a list that will be a combination of terms and values, a definition list is a good choice.

About This Article

This article is from the book:

About the book author:

Andy Harris taught himself programming because it was fun. Today he teaches computer science, game development, and web programming at the university level; is a technology consultant for the state of Indiana; has helped people with disabilities to form their own web development companies; and works with families who wish to teach computing at home.

This article can be found in the category: