Is it possible to specify a starting number for an ordered list?
You can define the starting number of an ordered list using the start
attribute:
This list starts the numbering at 10, not 1. Remember, "it's not about the destination, it's about the journey".
The 'start' attribute: Kickstarting your ordered lists
Get it started with 'start'
The start
attribute is a practical and convenient tool in HTML5 for initiating the numbering of list items in an ordered list:
In other words, it's like choosing your spot in the queue with a 💯 starting point.
The compatibility saga: HTML5 vs HTML 4.01
If start
can't remember its past, it's doomed to repeat it! But thankfully, despite leaving start
behind in HTML 4.01, HTML5 has embraced it again. Just be sure to declare <!DOCTYPE html> for HTML5 support:
CSS: Stepping up the list game
When simple HTML attributes feel too.....simple, level up with CSS counters:
- Use
counter-reset
onol
to set the starting point:
- Tale as old as time, but your lists just got a Disney-level makeover with CSS counters!
Controlling list item numbers: Mastering the 'value' attribute
Sometimes you wish to control the numbers of individual list items. The value
attribute becomes your magic wand:
Now, '5' has jumped the queue, but the rest carried on like nothing happened.
Handling the challenges: A fundamental guide
Cross-browser compatibility: A necessary evil
With great power comes great responsibility, and that applies to cross-browser compatibility too! Test across different browsers to avoid terrible, horrible, no good, very bad display issues.
A nod to accessibility
Ensure that your fancy list numbering doesn't confuse assistive technologies or the order of your content while it's being narrated.
Enter JavaScript: Handling dynamic lists
In a world where lists grow and shrink dynamically, consider JavaScript to manipulate the start
attribute or apply CSS counters, ensuring flexibility and consistency.
A treasure of practical examples
- I contain multitudes in JSFiddle and In CodePen we trust - live demos exhibiting HTML and CSS strategies.
- Keep it real with these practical examples. You're not just writing code, you're crafting experiences.
Was this article helpful?