HTML Unorder List

The HTML <ul> tag is used to create an unordered list of items on a web page. An unordered list is a list of items that are not numbered or ordered in any specific way. It is typically used to create a list of items that do not have a particular order or hierarchy.

Here is an example of how to use the <ul> tag:

<ul>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>

In this example, the <ul> tag is used to define an unordered list, and each item in the list is represented by an <li> tag. The text “Item 1”, “Item 2”, and “Item 3” will be displayed in the browser as a bulleted list.

The <ul> tag can also be nested inside another <ul> tag to create sub-lists. Here’s an example:

<ul>
  <li>Item 1</li>
  <li>Item 2
    <ul>
      <li>Sub-item 1</li>
      <li>Sub-item 2</li>
    </ul>
  </li>
  <li>Item 3</li>
</ul>

In this example, the second item in the list has a sub-list that is defined by another <ul> tag. The text “Sub-item 1” and “Sub-item 2” will be displayed as a sub-list under “Item 2”.

The <ul> tag also has several attributes that can be used to customize the appearance of the list, including:

  • type: Specifies the type of bullet used in the list. The most common values for this attribute are disc (a solid circle), circle (an empty circle), and square (a solid square).
  • class and id: Used to add CSS styling or JavaScript functionality to the list.

Here’s an example of how to use the type attribute:

<ul type="circle">
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>

In this example, the type attribute is set to circle, so the list will use an empty circle bullet instead of a solid circle bullet.

Overall, the <ul> tag is a simple but useful tool for creating lists of items on a web page.