HTML <ol> start Attribute

HTMLWeb DevelopmentFront End Technology

The start attribute of the <ol> element is used to set the start value of the first list item.. Following is the syntax−

<ol start="num">

Above, num is the number set for the start value of the first list item. Let us now see an example to implement the start attribute of the <ol> element−

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h1>Last Semester MCA Result</h1>
<h2>Rank from 1-5</h2>
<ol>
   <li>Steve</li>
   <li>David</li>
   <li>Kane</li>
   <li>William</li>
   <li>John</li>
</ol>
<h2>Rank from 5-10</h2>
<ol start="5">
   <li>Tom</li>
   <li>Jack</li>
   <li>Will</li>
   <li>Harry</li>
   <li>Tim</li>
</ol>
</body>
</html>

Output

In the above example, we have two unordered lists that displays the rank−

<h2>Rank from 1-5</h2>
<ol>
   <li>Steve</li>
   <li>David</li>
   <li>Kane</li>
   <li>William</li>
   <li>John</li>
</ol>
<h2>Rank from 5-10</h2>
<ol start="5">
   <li>Tom</li>
   <li>Jack</li>
   <li>Will</li>
   <li>Harry</li>
   <li>Tim</li>
</ol>

The second list displays a start attribute that allows custom start value 5 instead the default 1−

<ol start="5">
   <li>Tom</li>
   <li>Jack</li>
   <li>Will</li>
   <li>Harry</li>
   <li>Tim</li>
</ol>
raja
Published on 19-Jun-2019 15:03:23
Advertisements