<ul> Tag in HTML | Creating Unordered Lists

The <ul> tag in HTML is used to define an unordered (bulleted) list. Each item within the list is represented by the <li> (list item) tag. Unordered lists are ideal when the sequence of items does not matter.

Key Points on <ul> Tag:

Syntax of <ul> Tag:

Syntax Example

<ul>
            <li>First item</li>
            <li>Second item</li>
            <li>Third item</li>
        </ul>

Example of Using <ul> Tag:

This example creates an unordered list of three items:

Code Example

<ul>
            <li>Apples</li>
            <li>Bananas</li>
            <li>Cherries</li>
        </ul>

Output

  • Apples
  • Bananas
  • Cherries

Styling the <ul> Tag:

You can customize the appearance of unordered lists using CSS. Below are some examples of different list styles:

Code Example with Custom Bullets

<ul style="list-style-type: square;">
            <li>Custom Square Bullet</li>
            <li>Another Item</li>
            <li>One More Item</li>
        </ul>
        
        <ul style="list-style-type: circle;">
            <li>Circle Bullet</li>
            <li>Item Two</li>
            <li>Item Three</li>
        </ul>

Output

▪ Custom Square Bullet ▪ Another Item ▪ One More Item ○ Circle Bullet ○ Item Two ○ Item Three

Best Practices for Using <ul> Tag:

The <ul> tag is an essential HTML element for creating lists of items where the order is not important. Customizing the style and layout of unordered lists helps improve readability and can make content more visually appealing.