HTML Reference ยท Text Content
The <ul> element
Reference for the HTML <ul> element: bulleted lists where order doesn't matter, nesting, styling and removing bullets, navigation lists and technical details.
The <ul> element is an unordered list: a group of <li> items where the order doesn't change the meaning, such as features, ingredients or tags. Browsers show a bullet before each item. It is also the usual base for navigation bars and card grids.
<ul> <li>Free shipping</li> <li>30-day returns</li> </ul>
Try it
Nested lists switch to a different bullet automatically (disc, then circle, then square); here the CSS forces squares.
Attributes
This element has no attributes of its own. It accepts the global attributes. The old type and compact attributes are obsolete; use the CSS list-style-type property and spacing rules instead.
Usage notes
- Order doesn't matter. If shuffling the items would change the meaning, use
<ol>instead. - Only
<li>children. Put everything, including nested lists, inside<li>elements. - Change the bullets with CSS.
list-style-type(disc, circle, square, none, or a string such as"โ ") and the::markerpseudo-element control the markers. - Navigation. A list of links inside a
<nav>is a common, accessible pattern: users hear how many links there are. - Accessibility. Some browsers stop exposing a list as a list when you set
list-style: none. If the list semantics matter, addrole="list"to the<ul>.
Technical summary
| Content categories | Flow content; palpable content if it has at least one <li> child |
| Permitted content | Zero or more <li> elements and script-supporting elements |
| Tag omission | None; both the start and end tags are required |
| Permitted parents | Any element that accepts flow content |
| Implicit ARIA role | list |
| DOM interface | HTMLUListElement |
| Default display | block |
Browser support
Supported in every browser.
Related
<li>โ the items inside<ol>โ ordered lists<menu>โ lists of commands<nav>โ navigation sections- Lesson: Lists
- Lesson: Nested Lists
- Lesson: Building Navigation Menus