Ordered [Numbered] Lists: <OL>
This will create a numbered list starting with 1. It also indents.
Here's the code:
Here are the results:
- Apples
- Bananas
- Figs
- Pears
Each <LI> creates a new numbered item.
To start a list with a number other than 1 we can use the start attribute.
For example, we can start with the number five.
Here's the code:
Here are the results:
- Apples
- Bananas
- Figs
- Pears
To start a list with something other than numbers, we can use the type attribute.
For example, we can use Alphabets:
Here's the code:
Here are the results:
- Apples
- Bananas
- Figs
- Pears
Here are the different types of lists you can use:
Value | Style | Example |
1 | Arabic | 1, 2, 3, 4... |
A | Uppercase alpha | A, B, C, D... |
a | Lowercase alpha | a, b, c, d... |
I | Uppercase Roman | I, II, III, IV... |
i | Lowercase Roman | i, ii, iii, iv... |
You can also use nested lists.
For example, we can nest a Roman list inside an Arabic list.
Here's the code:
Here are the results:
- Apples
- Red
- Green
- Yellow
- Bananas
- Figs
- Pears
If we do not have a need for a numbered list, we can use an unordered list. This will list items without numbers.
Here's the code:
Here are the results:
- CPU
- Monitor
- Printer
- Keyboard
- Mouse
You can also nest them the same way as Ordered Lists.
We can choose the type of bullet with the type attribute.
Here's the code:
Here are the results:
- CPU
- Monitor
- Printer
- Keyboard
- Mouse
You can use "disc", "square", or "circle" bullet types.
Definition [or Glossary] List: <DL>
This type of list shows up like a Glossary with a term and an indented definition.
Here's the code:
Here are the results:
- CPU
- CPU is the Central Processing Unit of a computer system.
- Monitor
- This unit is used to show current events of a computer system.
- Printer
- This unit is used to produce hard copies of documents.