Definition
The <ul>
tag is used to create an unordered list, which is typically a set of bullet points.
Example
<ul>
<li>An item</li>
<li>An item</li>
<li>An item</li>
</ul>
Usage
An opening and closing tag is required.
The
<ul>
element is used with child<li>
elements representing the list items.<script>
or<template>
elements are also allowed as child elements.The
<ul>
and<li>
elements may be repeatedly nested within each. For example:<ul> <li>first item <ul> <li>first item</li> <li>second item</li> <li>third item</li> </ul> </li> <li>second item</li> <li>third item</li> </ul>
You can alternate between
<ul>
and<ol>
elements as required. For instance, you can start with a bullet list and have a nested numbered list.<ul> <li> first item <ol> <li>first item</li> <li>second item</li> <li>third item</li> </ol> </li> <li>second item</li> <li>third item</li> </ul>
Attributes
The <ul>
element only supports the Global Attributes.
Best Practices
- The
<ul>
element represents an unordered list. This means the order does not matter. If the order of the list does matter, for example, a list of steps or directions, you should use an ordered list using the<ol>
tag.
Specification
Browser Support
Desktop
Chrome | Edge | Firefox | IE | Opera | Safari |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |
Mobile
Android Webview | Chrome Android | Firefox Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |