×

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 Links

It consist of anchor element which is used to create a link between a source anchor and destination anchor. The anchor tag can be embedded between text, image, video or...

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

HTML SVG

HTML SVG: SVG stands for Scalable Vector Graphics which defines the graphics for the web. It is a language for describing 2-D graphics in XML. Each drawn shape in SVG is...

1 minute read.

How to change font in HTML

To give style to the content of your website, you may change the font of the text and make your website look attractive to the user. There are several methods which...

4 minutes read.

HTML Reset Button

The HTML reset button is used to reset all values in the form. It clears all input fields. Reset is the value of the type attribute of the button element. The...

6 minutes read.

HTML Code

Before jumping into the topic, let’s understand a common scenario where we have a code snippet in our HTML file. By code snippet, we mean computer code, which is written...

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

HTML Code Tag

The code tag in HTML is a phrase tag used to insert a piece of computer programming code. In HTML there is a separate tag named as <code> tag. Sometimes,...

3 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 <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 &lt;datalist >Tag

The autocomplete feature in HTML files is provided by the <datalist> tag. It can be used in conjunction with an input tag to enable users to quickly fill out form...

4 minutes read.

HTML Data Tag

HTML Data Tag: The HTML < data > tag is used to transmit its content to a machine-readable version. The data are presented in a particular format. It is useful...

3 minutes read.

HTML Text Format

Introduction HTML may format text in two different ways. The HTML tags define a text property to make it appear one way or another. A text element may also be formatted...

7 minutes read.

HTML5 Attribute

HTML Attribute HTML attributes are special words that provide additional information about the HTML element or attributes.The element or tags have attributes, which define the element's behavior.It also adds attributes with a start...

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

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.

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