Ol Tag in HTML5

In this article I am going to describe about the implementation and use of Ol Tag in HTML5.
  • 1700

<ol> Tag

The <ol> tag defines an ordered list. An ordered list can be numerical or alphabetical. In other words, the ordered list is represented as listing by number serially. <ol> tag must have opening and closing tags.

<li> tag is used to define list items.

Syntax

The syntax for <ol> tag is

<ol>List of ordered items</ol>

This tag have two specific attributes are as:

start="value"    This attribute value specify the list value of the first list item. The number must be a ordinal value.

reversed="value"  This attribute indicates that the list item is in descending if present and in ascending if not present.

Browser Support

It is supported in all major browsers.

Attribute

  Attribute      Value             Description
   reversed    reversed   specifies that the list order should be descending
     start    number   specifies the start value of an ordered list
     type     1,A,a,I,i     
     Value           Description
       1  Represents decimal numbers (eg. 1. 2. 3. ... etc)
       A  Represents upper case latin alphabet (eg. A. B. C. ... etc)
       a  Represents lower case latin alphabet (eg. a. b. c. ... etc)
       I  Represents upper case roman numerals (eg. I. II. III. ... etc)
       i  Represents lower case roman numerals (eg. i. ii. iii. ... etc)

Start attribute is not supported by HTML4.01 but HTML5 support it.

The reversed attribute is the new introduction in HTML5.

Example of <ol> tag in HTML5

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>

    <meta charset="utf-8" />

    <title>Ol Tag in HTML5</title>

</head>

<body>

    <ol>

        <li>C</li>

        <li>C++</li>

        <li>Java</li>

        <li>Oracle</li>

        <li>Asp.Net</li>

    </ol>

 

    <ol start="10">

        <li>Maths</li>

        <li>English</li>

        <li>Science</li>

        <li>Hindi</li>

        <li>Geography</li>

    </ol>

</body>

</html>

Output

ol.jpg

© 2020 DotNetHeaven. All rights reserved.