HTML, or Hyper Text Markup Language, is the standard markup language for creating web pages and web applications. One common feature in HTML is the use of lists, which can be unordered (bulleted) or ordered (numbered). The correct HTML tag for creating an ordered list is <ol>
.
<ol>
TagAn ordered list, represented by the <ol>
tag, often communicates a set of steps, or a sequence of events or items. When using this tag, each item within the list should be wrapped in a <li>
(list item) element. For example:
<ol>
<li>Preheat the oven to 350 degrees</li>
<li>Mix flour and sugar</li>
<li>Add eggs and mix well</li>
<li>Bake for 30 minutes</li>
</ol>
In the above example, each step of a process (in this case, baking) is listed in a particular order, and the list is properly formed using the <ol>
and <li>
tags. When rendered on a web page, this list will appear as a numbered list.
While an unordered list (<ul>
) simply presents a bulleted list, an ordered list (<ol>
) gives valuable information about the list order to your users. Using ordered lists correctly and consistently can help improve your website usability.
The <ol>
tag can be customized. For instance, you can change the number type of the list with the type
attribute, or start your list from a different number with the start
attribute, like so:
<ol type="A" start="3">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
The list above will start with the letter "C". This shows that <ol>
provides a flexible and powerful way to present ordered information on the web.