HTML Ordered Lists
- We can specify the numbers to elements in the list.
- This list is created by using <ol> tag.
- The numbering starts at one and is incremented by one for each successive ordered list element tagged with <li>.
<!DOCTYPE html>
<html>
<body>
<ol>
<li>Java</li>
<li>Python</li>
<li>Data Science</li>
<li>Machine Learning</li>
</ol>
</body>
</html>
The type Attribute
- You can use type attribute for <ol> tag to specify the type of numbering you like.
- By default it is a number.
- Following are the possible options :
- <ol type=”1″> – Default-Case Numerals.
- <ol type=”I”> – Upper-Case Numerals.
- <ol type=”i”> – Lower-Case Numerals.
- <ol type=”a”> – Lower-Case Letters.
- <ol type=”A”> – Upper-Case Letters
<!DOCTYPE html>
<html>
<body>
<ol type="I">
<li>Java</li>
<li>Python</li>
<li>Data Science</li>
<li>Machine Learning</li>
</ol>
</body>
</html>
The start Attribute: You can use start attribute for <ol> tag to specify the starting point of numbering you need.
- <ol type=”1″ start=”4″> – Numerals starts with 4.
- <ol type=”I” start=”4″> – Numerals starts with IV.
- <ol type=”i” start=”4″> – Numerals starts with iv.
- <ol type=”a” start=”4″> – Letters starts with d.
- <ol type=”A” start=”4″> – Letters starts with D.
<!DOCTYPE html>
<html>
<body>
<ol type="i" start="4">
<li>Java</li>
<li>Python</li>
<li>Data Science</li>
<li>Machine Learning</li>
</ol>
</body>
</html>