Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

82 LESSON 5: Organizing Information with Lists


Output ▼


Definition lists usually are formatted in browsers with the terms and definitions on sepa-
rate lines, and the left margins of the definitions are indented.
You don’t have to use definition lists for terms and definitions, of course. You can use
them anywhere that the same sort of list is needed. Here’s an example involving a list of
frequently asked questions:
<dl>
<dt>What is the WHATWG?</dt>
<dd>The Web Hypertext Application Technology Working Group (WHATWG) is a growing
community of people interested in evolving the Web. It focuses primarily on the
development of HTML and APIs needed for Web applications.</dd>
<dt>What is the WHATWG working on?</dt>
<dd>The WHATWG's main focus is HTML5. The WHATWG also works on Web Workers and
occasionally specifications outside WHATWG space are discussed on the WHATWG
mailing list and forwarded when appropriate.</dd>
<dt>How can I get involved?</dt>
<dd>There are lots of ways you can get involved, take a look and see What you can
do!</dd>
<dt>Is participation free?</dt>
<dd>Yes, everyone can contribute. There are no memberships fees involved, it's an
open process. You may easily subscribe to the WHATWG mailing lists. You may also
join the the W3C's new HTMLWG by going through the slightly longer application
process.</dd>
</dl>

Nesting Lists


What happens if you put a list inside another list? Nesting lists is fine as far as HTML is
concerned; just put the entire list structure inside another list as one of its elements. The
nested list just becomes another element of the first list, and it’s indented from the rest of
the list. Lists like this work especially well for menu-like entities in which you want to
show hierarchy (for example, in tables of contents) or as outlines.

FIGURE 5.8
A definition list.
Free download pdf