Lists in XHTML. Two main types of lists Ordered Lists sequences (e.g. the steps in a recipe) or...

Post on 04-Jan-2016

217 views 0 download

Transcript of Lists in XHTML. Two main types of lists Ordered Lists sequences (e.g. the steps in a recipe) or...

Lists in XHTML

Two main types of lists

Ordered Lists• sequences (e.g. the steps

in a recipe) or preferences• carry numbers (Arabic or

Latin) or letters

Example:1. first step2. second step3. third step

Unordered Lists• items that do not have a

natural order (e.g. the ingredients in a recipe)

• carry bullet points, symbols or dashes

Example:– first item– second item– third item

XHTML Markup

Source Code:

<ol><li>first item</li><li>second item</li><li>third item</li>

</ol>

Result in the browser:

1. first item2. second item3. third item

Advantages

• numbering is done automatically:

My favourite books:1. Alice in Wonderland2. Peter Pan3. Lord of the Rings Harry Potter

Advantages

Source Code:<ol>

<li>Alice in Wonderland</li><li>Harry Potter</li><li>Peter Pan</li><li>Lord of the Rings</li>

</ol>

The new list:

My favourite books:1. Alice in Wonderland2. Harry Potter3. Peter Pan4. Lord of the Rings

Nested Lists

Writing a term paper:1. Finding a topic2. Collecting literature

– from the library– from the internet

3. Writing the text

Source code:<ol>

<li>Finding a topic</li><li>Collecting literature <ul> <li>from the library</li> <li>from the internet</li> </ul></li><li>Writing the text</li>

</ol>