Open In App

How to define a list item in HTML5?

Last Updated : 29 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

To define a list in HTML5 we can use the HTML <li> tag. But there are two types of listing in HTML. One is an ordered list and another one is an unordered list. For ordered we can use HTML <ol> tag and for the unordered list, we will use the HTML <ul> tag.

Also, we can change the list type, for that, you can check the below articles.

Ordered list: It defines  a list of items  in which the order of item matters. An ordered list is also called a number list. The list items are enclosed  within <ol> and </ol>tags. The ordering is given by numbering scheme, using Arabic numbers, letters or roman numerical. 
 

Syntax:

<ol>
      <li>List item 1</li>
      <li>List item 2</li>
</ol>

Unordered list: It is used for items in which the ordering is not specific. An unordered  list also called bulleted list. The list is defined using the <ul> and <ul/>tags. Each time in the list is defined using the <li> tag.
 

Syntax:

<ul>
      <li>List item 1</li>
      <li>List item 2</li>
</ul>

 

Example: The following code demonstrates both the ordered list and un-ordered list.

 

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h1>GeeksforGeeks</h1>
    <ol>
        <li>Geeks</li>
        <li>Sudo</li>
        <li>Gfg</li>
        <li>Gate</li>
        <li>Placement</li>
    </ol>
    <ul>
        <li>Geeks</li>
        <li>Sudo</li>
        <li>Gfg</li>
        <li>Gate</li>
        <li>Placement</li>
    </ul>
</body>
 
</html>


Output:

ordered list and un-ordered list


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads