How to set the start value of an ordered list in HTML5 ?
Last Updated :
17 Mar, 2021
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″ .
HTML
<!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>.
HTML
<!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
Share your thoughts in the comments
Please Login to comment...