How to add a list in html

problem

You’re learning HTML and wish to place some information on your webpage as a list, either bullet point or numbered list. In this post we will see how to do that.

SOLUTION

Using the <ul> tag or the <ol> tag. Both of the tags have opening and closing tags. Moreover we need to use the <li> tag (nested) for each list item.

Let’s see examples.

Unordered list example
list.html
				
					<ul>

</ul>

				
			

The code above will create an unordered list (ul). In order to show some items we need to place them using the list item <li> tag. For example:

list.html
				
					<ul>
    <li>First item</li>
    <li>Second item</li>
    <li>Third item</li>
</ul>
				
			

As you can see the <li> tag has an opening and a closing tag. It’s used as a nested tag inside the <ul> tag.

output
unordered list example in html
Ordered list example
list.html
				
					<ol>

</ol>

				
			

The code above will create an ordered list (ol). The opposite of an unordered list (ul). Again, we can place list items by using the <li> tag.

list.html
				
					<ol>
    <li>First item</li>
    <li>Second item</li>
    <li>Third item</li>
</ol>
				
			

This tag automatically puts a number next to each list item instead of a bullet point. The number starts from 1 and increments by 1.

output
ordered list example in html

conclusion

In this post we saw how to use the <ul> for unordered list (bullet points) and the <ol> for ordered list (numbered points). Also, we’ve seen how to utilize the <li> tag to insert each list item in the list. The <ul> and <ol> can be nested and have sublists if you wish.

Share it!

Facebook
Twitter
LinkedIn
Reddit
Picture of Ellion

Ellion

Professional IT consultant, writer, programmer enthusiast interested in all sorts of coding.
Eats all cookies 🍪

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

Google Analytics Cookies

This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping this cookie enabled helps us to improve our website.

HotJar Cookies

We use Hotjar in order to better understand our users’ needs and to optimize this service and experience. Hotjar is a technology service that helps us better understand our users’ experience (e.g. how much time they spend on which pages, which links they choose to click, what users do and don’t like, etc.) and this enables us to build and maintain our service with user feedback. Hotjar uses cookies and other technologies to collect data on our users’ behavior and their devices. This includes a device's IP address (processed during your session and stored in a de-identified form), device screen size, device type (unique device identifiers), browser information, geographic location (country only), and the preferred language used to display our website. Hotjar stores this information on our behalf in a pseudonymized user profile. Hotjar is contractually forbidden to sell any of the data collected on our behalf.

For further details, please see the ‘about Hotjar’ section of Hotjar’s support site.