×

HTML Ordered List

We use <ol> tag to make an ordered list in html. An ordered list is made to make a list of items in ordered form, ordered list can be either numerical or alphabetical.

Ordered HTML list

An ordered list starts with an <ol> tag and end with </ol> tag. And in ordered list we have list of items to give content to our list and it starts with <li> tag and ends with </li> tag. The list items will be marked with numbers by default.

For example:

<ol>
<li>coffee</li>
<li>tea</li>
<li>milk</li>   
</ol>

Output:

HTML Ordered List

In this example, we have used a <ol> tag for making the ordered list. And then we have used <li> tag for making the list items, and that’s how we create an ordered list in html.

Type attribute: Ordered list in type attribute

We use type attribute in html ordered list just to define the type of the list item marker.

Types and description:

  1. Type=’1’ : The list item will be numbered with numbers by (default)
  2. Type=’A’ : The list item will be numbered with upper case alphabets.
  3. Type=’a’ : The list items will be numbered with lower case alphabets.
  4. Type=’I’ : The list items will be numbered with upper case roman numbers.
  5. Type=’I’ : The list items will be numbered with lower case roman numbers.

Example of any one type would be:

<ol type='A'>
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol>

And the output would be:

A) Coffee
B) Tea
C) Milk

And we can try out others as well in the same manner.

Control list counting

So we are talking about ordered list then we should know that, an ordered list will always start counting from 1. But if someone wants to start his ordered list from some other number then he can use start attribute and start his list from any number of his choice.

For example:

<ol start=”50”>
<li>coffee</li>
<li>tea</li>
<li>milk</li>
</ol>

Output:

HTML Ordered List

Nested HTML list

In html we can have nested lists which means lists inside list.

For example:

<ol>
<li>coffee</li>
<li>tea
<ol>
<li>black tea</li>
<li>green tea</li>
</ol>
</li>
<li>milk</li>
</ol>

Output:

HTML Ordered List

Tip:

A <li> in html can contain a new list because of its nested property but the thing is that it can also contain html elements, like images, links and many other things as well.


Related Topics

Div Tag in HTML

In HTML, ‘div’ is a tag that specifies division or section in HTML document. But before going in detail of it, let’s first understand about tags in HTML. The tag...

8 minutes read.

HTML &lt;body> alink Attribute

HTML <body> alink Attribute What is HTML? The HTML or HyperText Markup Language is used to design web pages. The file extension name for HTML file is ".html". It was released in...

2 minutes read.

HTML Date

The input element in HTML has several attributes. One of its attributes is the type attribute which creates a calendar in an order that a user can select a date...

5 minutes read.

HTML Images

HTML has <img> tag to display image on the web pages or web application. This tag is an empty tag i.e. we don't have to close this tag while using. SYNTAX: <img src="source address" attributes="alt, height, width"> Example: <html>   <body>   <center>Image tag Example</center>   <img src="https://www.tutorialandexample.com/resources/images/favicon.png"    alt="tutorialandexample"/>   </body>   </html> Output: Image...

1 minute read.

HTML Forms

Forms are required when we want to collect data from the user. Html forms consists of different fields to take user inputs such as: input, text area, checkbox, password, radio...

4 minutes read.

HTML <video> Tag

The Video tag in HTML is used to play video on a media player on the web page. We can also insert an audio by the video tag, but audio...

6 minutes read.

HTML &lt;blink> Tag

In HTML, the blink tag is used to create the text which flashes. The blink tag is an inline element in HTML. It is observed that the blink tag used...

2 minutes read.

Design a tribute page using HTML and CSS

A tribute page is a webpage based on a person who inspired us in our life. In this article, we will create a webpage of Mahatma Gandhi. We are going...

5 minutes read.

HTML Form Input Types

HTML Form Input Types An important element of the HTML form is < input type= "> in HTML. The type attribute of the input element can be of different types, which...

8 minutes read.

HTML Search Box

The HTML search box is also known as the search bar. It is an input text field that is used to search the content. If the users want to explore...

7 minutes read.

HTML Youtube

<object> element: It embed the object within the HTML documents and embed plug-ins such as Java applets, PDF readers, Flash Players etc in web pages. Example: <object width="100" height="100" data="bookmark.swf"></object> <embed> element: It defines an embedded...

1 minute read.

How to insert spaces/tabs in text using HTML/CSS

What is HTML? HTML or HyperText Markup Language is used to design web pages. It was released in 1993. The file extension name for HTML file is “.html”. An HTML file...

4 minutes read.

HTML Anchor

HTML Anchor The HTML anchor tags define a hyperlink that links to other pages on one page. It can create hyperlinks to any web page and files, locations or any other...

3 minutes read.

HTML <script> Tag

For embedding a client -side script, we use script tag in html tag. This <script> tag can be used for containing scripting statements. It can also point another external script file...

2 minutes read.

HTML5 Tags

HTML5 Tags A list of newly included tags is provided in HTML5. These HTML 5 tags (elements) provide a better structure for the document. This list shows description of all HTML...

3 minutes read.

Most Commonly used Tags in HTML

In this tutorial, we'll look at the most popular HTML tags. We know HTML is a fundamental requirement for creating a website. As a result, it is essential to remember...

9 minutes read.

Font tag in HTML

HTML stands for Hypertext Mark-up Language and is used to create web pages and other information that can be later displayed in a web browser. It also consists of a...

4 minutes read.

HTML Nested Table

HTML nested table refers to a table that is created inside another table. The table is in the form of rows and columns. From left to right are called horizontal rows,...

5 minutes read.

HTML Hide Element

The HTML hide element is used to hide the element. We place the hidden attribute inside those elements which we want to hide. The hidden attribute is a Boolean attribute. The...

3 minutes read.

HTML <body> tag

HTML means Hyper Text Markup Language, which is most preferred for making Web pages. It explains how a Web page is put together. There are many different elements in HTML,...

3 minutes read.