HTML Ordered Lists


In HTML, ordered lists are used to represent a list of items in a specific order or sequence. The <ol> (ordered list) element is used to define the list, and each item within the list is represented by the <li> (list item) element.

Here's an example of an ordered list:

<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>

This code will render as follows:

1. First item

2. Second item

3. Third item

With CSS, you may alter the numbering's look. For example:

<style>
  ol {
    list-style-type: upper-roman; /* Use uppercase Roman numerals for numbering */
  }
</style>

<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>

In this example, the list-style-type property is set to "upper-roman," changing the default numbering style to uppercase Roman numerals.


You can use various values for the list-style-type property, such as "decimal" (default), "lower-alpha," "upper-alpha," "lower-roman," "upper-roman," and others, to achieve different numbering styles.

<style>
  ol {
    list-style-type: lower-alpha; /* Use lowercase letters for numbering */
  }
</style>

<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>

This code will display the items with lowercase alphabetical numbering:

a. First item

b. Second item

c. Third item

Feel free to experiment with different values to achieve the desired visual effect for your ordered lists.

Post a Comment

Previous Post Next Post

Popular Items