docs.rodeo

MDN Web Docs mirror

{{HTMLSidebar}} 

The <ul> HTML element represents an unordered list of items, typically rendered as a bulleted list.

{{InteractiveExample("HTML Demo: &lt;ul&gt;", "tabbed-standard")}} 

<ul>
  <li>Milk</li>
  <li>
    Cheese
    <ul>
      <li>Blue cheese</li>
      <li>Feta</li>
    </ul>
  </li>
</ul>
li {
  list-style-type: circle;
}

li li {
  list-style-type: square;
}

Attributes

This element includes the global attributes.

Usage notes

Examples

Basic example

<ul>
  <li>first item</li>
  <li>second item</li>
  <li>third item</li>
</ul>

Result

{{EmbedLiveSample("Basic_example", 400, 120)}} 

Nesting a list

<ul>
  <li>first item</li>
  <li>
    second item
    <!-- Look, the closing </li> tag is not placed here! -->
    <ul>
      <li>second item first subitem</li>
      <li>
        second item second subitem
        <!-- Same for the second nested unordered list! -->
        <ul>
          <li>second item second subitem first sub-subitem</li>
          <li>second item second subitem second sub-subitem</li>
          <li>second item second subitem third sub-subitem</li>
        </ul>
      </li>
      <!-- Closing </li> tag for the li that
                  contains the third unordered list -->
      <li>second item third subitem</li>
    </ul>
    <!-- Here is the closing </li> tag -->
  </li>
  <li>third item</li>
</ul>

Result

{{EmbedLiveSample("Nesting_a_list", 400, 340)}} 

Ordered list inside unordered list

<ul>
  <li>first item</li>
  <li>
    second item
    <!-- Look, the closing </li> tag is not placed here! -->
    <ol>
      <li>second item first subitem</li>
      <li>second item second subitem</li>
      <li>second item third subitem</li>
    </ol>
    <!-- Here is the closing </li> tag -->
  </li>
  <li>third item</li>
</ul>

Result

{{EmbedLiveSample("Ordered_list_inside_unordered_list", 400, 190)}} 

Technical summary

Content categories Flow content, and if the <ul> element's children include at least one `{{HTMLElement("li")}}`  element, palpable content.
Permitted content Zero or more `{{HTMLElement("li")}}` , `{{HTMLElement("script")}}`  and `{{HTMLElement("template")}}`  elements.
Tag omission None, both the starting and ending tag are mandatory.
Permitted parents Any element that accepts flow content.
Implicit ARIA role list
Permitted ARIA roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree
DOM Interface `{{domxref("HTMLUListElement")}}` 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN