
How to make a List in Html
To create a list in HTML, you can use the <ul>
(unordered list) or <ol>
(ordered list) tags along with the <li>
(list item) tags. Here’s an example of how to create both an unordered list and an ordered list:
<!DOCTYPE html>
<html>
<head>
<title>List Example</title>
</head>
<body>
<h1>Types of Fruits</h1>
<h2>Unordered List:</h2>
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
</ul>
<h2>Ordered List:</h2>
<ol>
<li>Strawberry</li>
<li>Watermelon</li>
<li>Grapes</li>
</ol>
</body>
</html>
In the above example, the <ul>
tag creates an unordered list, and each list item is defined using the <li>
tag. The content of each list item is placed between the opening and closing <li>
tags.
Similarly, the <ol>
tag creates an ordered list, where the list items are automatically numbered. The numbering is determined by the order of the <li>
tags.
You can add as many list items as needed within the <ul>
or <ol>
tags. You can also nest lists by placing a new <ul>
or <ol>
tag inside an <li>
tag.
Feel free to adjust the content and styling of the list items to fit your specific needs.