The <ul>
element in HTML represents an unordered list. The <ul>
element is typically used with the <li>
element to create a bulleted list.
The <ul>
element may be nested as deeply as you desire. Similar to most HTML elements, the <ul>
element can be styled using CSS.
The <ul>
element includes only global attributes and supports all the usual events supported by HTML elements.
The code below shows how the <ul>
element works in HTML:
The code above shows three different examples of how to use the <ul>
element.
The first example in line creates a simple unordered list with items. Each <li>
element represents a single item. Since all the <li>
elements are nested within the <ul>
element, the list has no particular order.
In the second example in line , the <ul>
element creates a nested list of unordered items. Each <li>
element contains another <ul>
element within itself, which allows for the sub-items to be rendered.
The third example in line is similar to the second example. However, this time, the <ol>
element is used to create an ordered list of sub-items. The main item list remains unordered since everything is nested within the <ul>
element.
Note: For further details regarding the
<ul>
element, you can check the documentation.
Free Resources