How to Start Ordered List from Specific Number in HTML
To start an ordered list from a specific number in HTML, use the
start attribute on the <ol> tag with the desired starting number. For example, <ol start="5"> will begin the list numbering at 5.Syntax
The start attribute on the <ol> element sets the starting number of the list.
<ol start="number">: Begins the list numbering at the specifiednumber.<li>: Each list item increments the number automatically.</ol>: Closes the ordered list.
html
<ol start="3">
<li>Item one</li>
<li>Item two</li>
<li>Item three</li>
</ol>Output
3. Item one
4. Item two
5. Item three
Example
This example shows an ordered list starting at number 5. The list items will be numbered 5, 6, and 7 automatically.
html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Ordered List Start Example</title> </head> <body> <ol start="5"> <li>First item</li> <li>Second item</li> <li>Third item</li> </ol> </body> </html>
Output
5. First item
6. Second item
7. Third item
Common Pitfalls
One common mistake is to try to set the starting number on individual <li> elements instead of the <ol> tag. The start attribute only works on the <ol> element.
Another pitfall is forgetting that the start attribute only accepts positive integers. Negative or zero values will be ignored or cause unexpected results.
html
<!-- Wrong way: start attribute on li (ignored) --> <ol> <li start="5">Item one</li> <li>Item two</li> </ol> <!-- Right way: start attribute on ol --> <ol start="5"> <li>Item one</li> <li>Item two</li> </ol>
Output
1. Item one
2. Item two
5. Item one
6. Item two
Quick Reference
| Attribute | Description | Example |
|---|---|---|
| start | Sets the starting number of the ordered list | |
| type | Changes the numbering style (e.g., numbers, letters) | |
| reversed | Reverses the numbering order |
Key Takeaways
Use the
start attribute on the <ol> tag to begin numbering from any positive number.Do not put the
start attribute on <li> elements; it only works on <ol>.The
start attribute accepts only positive integers; zero or negative values are invalid.Combine
start with other attributes like type or reversed for more control over list numbering.Always test your list in a browser to confirm the numbering appears as expected.