×

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

Html Wbr Tag

The Line Break Opportunity element A word break opportunity is a place in text from where the browser breaks a line. This opportunity is represented by the element wbr in the...

2 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.

How to append HTML code to a div using JavaScript?

In HTML, we have a div tag which is used to create a box where we can put a lot of other tags. So it works like a container. So,...

4 minutes read.

HTML Layouts

HTML Layouts HTML templates provide a way for well-managed, well-structured responsive web pages to be organized. We could say that the HTML layout specifies how web pages can be set up....

4 minutes read.

How to insert image in HTML

An image (technically digital image) in HTML or even in general technical aspects is a binary representation of visual information. By visual information we mean, in the form of drawings/pictures,...

5 minutes read.

HTML <sup> Tag

The HTML sup element is used to describe one or more superscript contents. The sup tag shows a text which is presented above the regular line and half the length...

2 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.

HTML <u> tag

Underline Element/Tag: The u tag in html is used to specify the important text or phrase by underline. In earlier HTML versions, this element was known as the "Underline" element, and...

5 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.

HTML <sub> tag

The sub element in HTML is used to describe one or more subscript texts. If The sub tag shows the text which is presented in a smaller font and below...

2 minutes read.

HTML Basic Tags

Heading Tags: This tag represents the document header. It is said to be a good practice if every document starts with Heading. Heading tags ranges from H1 to H6 i.e....

3 minutes read.

HTML Form Action

The <form> tag has an attribute named action that contains a URL. The HTML action attribute defines the webpage URL on which you want to send the data after submitting...

4 minutes read.

Html &lt;center> Tag

The term HTML refers to Hyper Text Markup Language. The most widely used markup language for making web pages is HTML. A structure of web page is described in HTML....

3 minutes read.

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...

3 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 Tutorial

Introduction This HTML tutorial helps beginners and professionals to learn HTML easily. HTML is a widely used web technology for website development. It stands for Hyper Text Markup Language. It is mainly used to...

7 minutes read.

How to add Google Translate Button on your Webpage?

Google translator is a multi-language translator used for translating the webpage. Google develops it. In today's digital age, it is essential because information is available worldwide in some specific language...

5 minutes read.

HTML Elements

An HTML element is nothing but a starting tag and then some content and then the closing tag. So we can say HTML elements is everything from the starting tag...

3 minutes read.

HTML <br> tag

HTML is referred to as Hyper Text Markup Language, which is the most popular language for creating Web pages. HTML explains the construction of a Web page. It contains a...

4 minutes read.

HTML <strong> tag

The strong element in HTML is used to display the real significant information in bold so that the user or reader will understand it easily. Syntax: <p> <strong>………… </strong> </p> Example Here, we will demonstrate how to...

2 minutes read.