A definition list is a sequence of terms and descriptions of these terms. The definition list are created using the
<dl>..</dl>
block. Inside
<dl>
element the following elements are inserted.
<dt>
tag - Definition term
<dd>
tag - Definition description
Definition lists are rendered differently on different browsers. All terms and descriptions are rendered on a new line. More than one terms and more than one description are included in the definition list.
snippet
<html>
<head></head>
<body>
<dl> List of Browsers/ Products
<dt> Firefox
<dd> A product of Mozilla
<dt> Chrome
<dt> Youtube
<dd> A product of Google
<dt> Internet Explorer
<dd> A product of Microsoft
<dl>
<body>
<html>
Output
List of Browsers/ Products- Firefox
- A product of Mozilla
- Chrome
- Youtube
- A product of Google
- Internet Explorer
- A product of Microsoft
Attributes of definition list
compact - A definitoin list can be rendered compactly if the compact(remove spaces) attribute is added to
<dl>
element. When the compact attribute is added the description starts on the same line as the associated term.
snippet
<html>
<head></head>
<body>
<dl compact> List of Browsers/ Products
<dt> Firefox
<dd> A product of Mozilla
<dt> Chrome
<dt> Youtube
<dd> A product of Google
<dt> Internet Explorer
<dd> A product of Microsoft
<dl>
<body><html>
Output
List of Browsers/ Products- Firefox
- A product of Mozilla
- Chrome
- Youtube
- A product of Google
- Internet Explorer
- A product of Microsoft