HTML <ul> Tag โ Unordered List
๐ Introduction
The <ul> tag is used to create an unordered list in HTML.
An unordered list is a list where items are shown with bullet points.
It is commonly used for:
- Navigation menus
- Feature lists
- Item groups
- Task lists
๐งฑ Syntax
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
๐ก Example
<!DOCTYPE html>
<html>
<head>
<title>UL Example</title>
</head>
<body>
<h2>My Skills</h2>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</body>
</html>
๐ฅ๏ธ Output Explanation
- The list appears with bullet points
- Each
<li>represents one item - The order does not matter
๐ฏ Important Rule
๐ <ul> always works with <li> (list item)
โ Correct:
<ul>
<li>Item</li>
</ul>
โ Wrong:
<ul>
Item
</ul>
๐ฏ When to Use <ul>
Use it for:
- Navigation menus
- Lists of features
- Grouped items
- Checklists
Example:
<ul>
<li>Fast</li>
<li>Responsive</li>
<li>Easy to use</li>
</ul>
โ๏ธ <ul> vs <ol>
| Tag | Type | Use |
|---|---|---|
<ul> |
Unordered list | Bullet points |
<ol> |
Ordered list | Numbered steps |
๐จ Styling Example
<ul style="list-style-type: square;">
<li>HTML</li>
<li>CSS</li>
</ul>
๐ซ Common Mistakes
- Missing
<li>items โ - Using
<ul>for layout โ - Forgetting structure โ
๐งช Mini Exercise
Create a page with:
- A list of your favorite programming languages
- A list of hobbies
- Style one list with square bullets