Description
The HTML element <ul>
is used to define an unordered list, where each item of the list is defined using the <li>
element.
The list is displayed with bullets in front of each item, where the bullet style can be a disc, circle, or square.
The below table summarizes its usage.
Usage Details | |
Placement | It is displayed as a Block element. |
Contents | It can contain one or more <li> elements. |
Tags | Both the opening and closing tags are required. |
Versions | HTML 2, 3.2, 4, 4.01, 5 |
Syntax
Here is the basic syntax of the <ul>
element.
<ul>...</ul>
Examples
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element ul</title>
</head>
<body>
<h2>Unordered List</h2>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</body>
</html>
Attributes
The following table shows the list of supported and unsupported attributes for the <ul>
element.
Attribute Type | Details |
Element-Specific Attributes | The tag <ul> has some element-specific attributes listed in the below table. |
Global Attributes | Like all other HTML tags, the tag <ul> supports the HTML Global Attributes. |
Event Attributes | The tag <ul> also supports the HTML Event Attributes. |
Here is a list of attributes that are specific to the <ul>
element.
Attribute | Value | Required | Description |
type |
circle, disc, square | No | Obsolete Specifies the shape of the bullet. |
compact |
compact |
No | Obsolete Boolean attribute that specifies whether the list should be rendered in a compact style or not. |
Browser Compatibility
The tag <ul>
is supported in all modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 2+
- Firefox 1+
- Apple Safari 1+
- Opera 4+