4.1 List Attributes
There are some useful attributes for use with HTML lists that help us control certain display factors:
| Attribute | Purpose |
|---|---|
| start | Defines the starting number for a list |
| type | Defines the type of bullet or numbering used for lists - see next table below |
| value | Defines the starting number for a list item |
Starting with the type attribute, the values vary and depend upon whether an unordered list or ordered list is being used:
| List Type | Values for Type | Format | Example |
|---|---|---|---|
| UL | disc | A solid donut | |
| circle | An unfilled circle | ||
| square | A solid square | ||
| OL | 1 | Numbers | 1, 2 , 3 |
| a | Lowercase Letters | a, b, c | |
| A | Uppercase Letters | A, B, C | |
| i | Lowercase Roman Numerals | i, ii, iii | |
| I | Uppercase Roman Numeral | I,II,III |
By default most browsers set the bullet points of unordered lists to disc and ordered lists to numbers starting at 1 unless specified otherwise. These can be overwritten using the values above. Note that the start and value attributes always use numbers but can be used with any of the type attribute values. For example, if type is set to letters and start is set to 5, the letters will begin at E. Here is an example using some of the above:
<ol type="i" start="5"> <li>A list item;</li> <li>Another list item.</li> <li value="10">Yet another list item.</li> </ol>
This would look like this in a browser:
- A list item;
- Another list item;
- Yet another list item;
Unfortunately all these attributes and their corresponding values are now deprecated and are better handled using CSS. This will be covered in the CSS Tutorial later.