HTML Ordered Lists

HTML Ordered Lists (OL) are used to display a list of items in a specific order, with each item numbered sequentially. Here’s an example of how to create an ordered list:

<ol>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>

In this example, the <ol> tag defines the ordered list and the <li> tags define each list item. The browser will automatically number each list item in sequential order.

You can also customize the numbering style by using the type attribute on the <ol> tag. Here are some examples:

<ol type="1"> <!-- default -->
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>

<ol type="A"> <!-- uppercase letters -->
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>

<ol type="a"> <!-- lowercase letters -->
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>

<ol type="I"> <!-- uppercase roman numerals -->
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>

<ol type="i"> <!-- lowercase roman numerals -->
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>

Additionally, you can use the start attribute to specify the starting number of the ordered list. For example:

<ol start="5">
  <li>Item 5</li>
  <li>Item 6</li>
  <li>Item 7</li>
</ol>

This will start the ordered list with the number 5 instead of 1.

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *