How to create an HTML list with items numbered 1, 2, 3, 4...?
How to create a simple list in HTML?
What is the use of HTML lists?
You need an ordered list <ol> which by default will order them by numbers.
you can use the type="a" attribute in HTML to change it to lower case letters. Alternatively, you can change it with CSS by adding the following property: list-style-type: lower-alpha;
These are the options an unordered list has:
| Sign | Type |
|---|---|
| a | lowercase letters |
| A | uppercase letters |
| i | lowercase Roman numerals |
| I | uppercase Roman numerals |
| 1 | numbers (default) |
The important thing is, that a "sub-list" must be still within the parent list point <li>
<ol type="A">
<li>1st 1st-level list item
<ol>2nd-level sublist
<li>1</li>
<li>2
<ol type="a">
<li>must be part of the 2nd main list point</li>
<li>must be part of the 2nd main list point</li>
<li>must be part of the 2nd main list point</li>
<li>must be part of the 2nd main list point</li>
</ol>
</li>
<li>for the 3rd main list point you need to add a new li</li>
</ol>
</li>
<li>2nd 1st level list-item</li>
</ol>
Ordered List Combined by numbers, lower case, and roman numerals
I had a similar situation where I needed to have full control over my ordered list.
This page needed to combine numbers, upper and lower case, and roman numerals.
I also had to control the initial number, letter, or roman numeral on independent sections.
Here is a summary of the CSS and HTML I currently use as a guideline.
ol.upper-letter {
list-style-type: upper-alpha;
}
ol.lower-letter {
list-style-type: lower-alpha;
}
ol.upper-roman-numerals {
list-style-type: upper-roman;
}
ol.lower-roman-numerals {
list-style-type: lower-roman;
}
<h4> Ordered List Combined by Numbers, Lower Case, and Roman Numerals</h4>
<ol start=”1”>
<li>first level</li>
<ol type='a' class='lower-letter' start='1'>
<li>second level</li>
<li>second level</li>
</ol>
<li>first level</li>
<ol type='a' class='lower-letter' start='3'>
<li>second level</li>
<ol type='i' class='lower-roman-numerals' start='1'>
<li>third level</li>
<li>third level</li>
</ol>
<li>second level</li>
</ol>
<li>first level</li>
</ol>