HTML | <ol> Tag

The <ol> tag is for ordered list, an ordered list can be numerical or alphabetical. Inside the <ol> tag you have to make a list <li> of items that will follow the order.

Syntax:

<ol>
   <li>Item1</li>
   <li>Item2</li>
   <li>Item3</li>
</ol>

Attributes:



  • compact: It defines the list should be compacted (compact attribute is not supported HTML5. Use CSS instead.).
  • reversed: It defines that the order will be descending.
  • start: It defines that from which number or alphabet the order will start.
  • type: It defines which type(1, A, a, I and i) of order you want in your list numeric, alphabetic or roman numbers.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>HTML ol tag</title>
</head>
  
<body>
    <h1 style="color:green;">GeeksforGeeks</h1>
    <h3>HTML <ol> tag</h3>
  
    <p>reversed attribute</p>
    <ol reversed>
        <li>HTML</li>
        <li>CSS</li>
        <li>JS</li>
    </ol>
  
    <p>start attribute</p>
    <ol start=5>
        <li>HTML</li>
        <li>CSS</li>
        <li>JS</li>
    </ol>
  
    <p>type attribute</p>
    <ol type="i">
        <li>HTML</li>
        <li>CSS</li>
        <li>JS</li>
    </ol>
  
</body>
  
</html>

chevron_right


Output:

Supported Browser: The browser supported by HTML <ol> tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : nidhi_biet



Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.