Published at
Updated at
Reading time
This post is part of my Today I learned series in which I share all my web development learnings.

I discovered an HTML attribute that I hadn't seen before. Let me introduce you to the value attribute. ๐Ÿ‘‡

Quick HTML tip: I just discovered that `li` elements support a `value` attribute to configure the start of an ordered list. Example showing an ordered list including a list item that defines a `value` property.

Trending Tweets often come with priceless comments. And it turned out that there are multiple ways to control the numbers of an ordered list.

Let's have a quick look!

Specify the list start using start

Manuel pointed out that the start attribute also allows you to specify the beginning of the unordered list. Ordered lists usually start at 1.


This functionality is valuable if your listings are divided by paragraphs and additional information.

Define the list item position using value

As already mentioned; if you want to control the position of a single list item, you can also use the value attribute on a specific list item.


This functionality is valuable if you're dealing with rankings and two entries are in the same position.

Bonus: Control list styles via CSS

And for completeness, there are also ways to control the list styles via list-style in CSS.


Read more about list-style on MDN.

If you're going for custom list styles, don't visually change the meaning of your listing to keep your HTML accessible in RSS feeds or assistive technology.

It's so fascinating that HTML still holds surprises for me after writing it for over ten years!

Was this TIL post helpful?
Yes? Cool! You might want to check out Web Weekly for more quick learnings. The last edition went out 18 days ago.

Related Topics

Related Articles

About the author

Stefan standing in the park in front of a green background

Frontend nerd with over ten years of experience, "Today I Learned" blogger, conference speaker, Tiny helpers maintainer, and DevRel at Checkly.