Open In App

How to set the start value of an ordered list in HTML5 ?

The start value of an ordered list in HTML5 can be specified by implementing the HTML <ol> start Attribute and passing the starting value (number) as the value to the attribute.

The next values of the list are automatically set in order (e.g. if starting value is set to be 5, the next value will be 6 then 7, and so on).



Syntax:

<ol start="Starting_value"> 
    <li> Content </li> 
</ol>

Example 1: After adding start=”4″ .






<!DOCTYPE html>
<html>
<head>
<title>Start Example</title>
</head>
<body>
<h3>Following is a list of oop languages</h3>
  <ol start="4">
    <li>C++</li>
    <li>Java</li>
    <li>JavaScript</li>
    <li>Python</li>
  </ol>
</body>
</html>

Output:

starts with 4

Example 2: After adding start=”15″ in <ol>.




<!DOCTYPE html>
<html>
<head>
<title>Start Example</title>
</head>
<body>
<h3>Grocery list:</h3>
  <ol start="15">
    <li>Oats</li>
    <li>Banana</li>
    <li>Milk</li>
  </ol>
</body>
</html>

Output:

Grocery list 2


Article Tags :