HTML Unordered List (<ul>):
The HTML Unordered List (<ul>) element is used to create lists where the order of items is not significant. Unordered lists are commonly employed when presenting information in a bulleted or visually separated format.
Here's a detailed guide on using the HTML Unordered List:
- Basic Syntax:
- The (<ul>) element is used to create an unordered list.
- List items within the unordered list are defined with the(<li>) (list item) element.
- First Item
- Second Item
- Third Item
- List Styles:
- Unordered lists typically display items with bullet points by default.
- The exact appearance of the bullet points can vary depending on the browser and the default styles applied by the browser.
- List Item Nesting:
- Unordered lists can be nested inside other list items to create a hierarchical structure.
- Main Item 1
- Sub-item A
- Sub-item B
- Main Item 2
- List Item Nesting:
- Unordered lists can be nested inside other list items to create a hierarchical structure.
- Main Item 1
- Sub-item A
- Sub-item B
- Main Item 2
<ul>
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
</ul>
Output:-
<ul> <li>Main Item 1 <ul> <li>Sub-item A</li> <li>Sub-item B</li> </ul> </li> <li>Main Item 2</li> </ul>Output:-
<ul>
<li>Main Item 1
<ul>
<li>Sub-item A</li>
<li>Sub-item B</li>
</ul>
</li>
<li>Main Item 2</li>
</ul>
Output:-
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Unordered List Example</title> </head> <body> <h1>Bulleted List Example</h1> <ul> <li>Item A</li> <li>Item B</li> <li>Item C</li> </ul> </body> </html>Output:-
Bulleted List Example
- Item A
- Item B
- Item C