HTML - Lists
HTML Tutorial - Lists
OK then, there are three types of list in HTML, unordered lists, ordered lists and definition lists.
Unordered list
An unordered list is presented with bullet points, and is generally used for lists which are in no particular order, such as a list of food for example.
To make an unordered list you use the <ul> HTML tag to start the list, and <li> (list item) tag to start and end each list item. An Example is shown below:
<ul>
<li>HTML Tutorials </li>
<li>PHP Tutorials </li>
<li>Web Design / Webmaster Tutorials</li>
</ul>
Now as you can see, the <li> tags are nested within the <ul> tags - and will generate the below list:
- HTML Tutorials
- PHP Tutorials
- Web Design / Webmaster Tutorials
You now know all there is to know about HMTL unordered lists - another nice web design skill!
Ordered Lists
An ordered list is a list organized by number (1,2,3 etc.) and is used to show lists which are in a particular order, such as instructions.
To make an ordered list you use the HTML <ol> tag, and <li> tags to define the list items (sound familiar?). An example is shown below:
<ol>
<li>Get in the car.</li>
<li>Put the key in the ignition.</li>
<li>Turn the key all the way to the right.</li>
</ol>
This would generate the following list:
- Get in the car.
- Put the key in the ignition.
- Turn the key all the way to the right.
And now you have mastered HTML ordered lists!
Definition List
A definition list is just what it sounds like, a list of definitions, so obviously you need a tag to open the list <dl> (definition list) and another two tags, one for the item title - <dt> (definition title) and the definition itself - <dd> (definition definition?).
Below is how you would construct a list of this type:
<dl>
<dt>Football (soccer)</dt>
<dd>A sport in which two teams of 11 men kick a leather ball around a large field for 90 minutes.</dd>
<dt>American Football</dt>
<dd>A sport in which the 'world series' does not contain any non-american team.</dd>
<dt>Rounders</dt>
<dd>A game played by small english schoolgirls at primary school (called baseball in USA).</dd>
</dl>
This would generate the following list:
- Football (soccer)
- A sport in which two teams of 11 men kick a leather ball around a large field for 90 minutes.
- American Football
- A sport in which the 'world series' does not contain any non-american team.
- Rounders
- A game played by small english schoolgirls at primary school (called baseball in USA).
You now know all there is to know about HMTL lists - use them wisely when designing your website!
I hope this came in useful!
Ask in the forum
if you have any suggestions or comments.
|