Lists in HTML
There are many types of lists that can be created. This section shows what they look like and how to write them.
<li> list element
Each item in a list should be preceded by a list element
. In most cases this will provide the item with a bullet or sequence number, depending on the type of list.
<ol> ordered list
An ordered list provides the list elements will sequential numbering.
type
This optional attribute enables you to select one of the following forms of numbering, where type=1
is the default:
1 | 1, 2, 3
|
---|
A | A, B, C
|
---|
a | a, b, c
|
---|
I | I, II, III
|
---|
i | i, ii, iii
|
---|
start
This optional attribute enables you to specify a start value for your list. The value is always specified in terms of 1, 2, 3, etc. regardless of any type
attribute.
<ol type=i start=2>
<li>At junction 10 take the M3 towards Sunbury.
<li>Turn off at junction 1 of the M3 and head towards Kingston
<li>3 miles after Kempton Park, take a left by The Bell pub.
</ol>
- At junction 10 take the M3 towards Sunbury.
- Turn off at junction 1 of the M3 and head towards Kingston
- 3 miles after Kempton Park, take a left by The Bell pub.
<ul> unordered list
An unordered list provides the list elements with bullets. As further indented levels of list are included, the bullet changes.
type
This optional attribute enables you to select one of the following forms of bullets:
Some band members:
<ul type=square>
<li>Pulp
<ul type=circle>
<li>Jarvis Cocker
<li>Russell Senior
</ul>
<li>The Wedding Present
<ul type=circle>
<li>David Gedge
<li>Simon Smith
</ul>
</ul>
Some band members:
- Pulp
- Jarvis Cocker
- Russell Senior
- The Wedding Present
<menu> menu list
, <dir> directory list
Of late, the menu and directory lists are rendered in exactly the same way as unordered lists.
<dl> definition list
, <dt> definition term
, <dd> definition definition
(sic)
Used to display a list of paired terms and definitions. Line breaks between each are automatically generated and the definition is shown indented.
Some definitions:
<dl>
<dt>plasma
<dd>a hot ionized gas containing positve ions and electrons
<dt>thyristor
<dd>a semi-conductor rectifier whose forward current between two electrodes, the anode and the cathode, is initiated by means of a signal applied to a third electrode, the gate. The current subsequently becomes independent of the of the signal.
<dt>quintessence
<dd>the most typical representation of a quality, state, etc.
</dl>
Some definitions:
- plasma
- a hot ionized gas containing positve ions and electrons
- thyristor
- a semi-conductor rectifier whose forward current between two electrodes, the anode and the cathode, is initiated by means of a signal applied to a third electrode, the gate. The current subsequently becomes independent of the of the signal.
- quintessence
- the most typical representation of a quality, state, etc.