In HTML, we have <ul> tag which defines the unordered list. And it is also known as bulleted list, because as we know it is not ordered list therefore it starts with bullets. So an unordered html list starts with <ul> tag and ends with </ul> tag as usual. In unordered list, we do have <li> tag to input some data into our unordered list, it starts with <li> tag and ends with </li>. The list items will be marked with bullets which are small black circles by default.
<ul> <li>cat</li> <li>dog</li> <li>lion</li> </ul>
Therefore, its output will be:
Choose list item marker: unordered html list
In CSS, we have a property named as list-style-type, which is used to define the style or we can say it is used to change the default style of our list item marker. It can have of the following values.
Values and description:
- Disc: sets the list item marker to a bullet by default.
- Circle: sets a list item marker to a circle.
- Square: sets the list item marker to a square
- None: the list item will not be marked.
For example (disc):
<ul style=”list-style-type:disc;”> <li>coffee</li> <li>tea</li> <li>milk</li> </ul>
Nested unordered HTML list:
Nested lists are same as we have seen in ordered lists. Nested lists means we can have lists inside list.
<ul> <li>coffee</li> <li>tea <ul> <li>green tea</li> <li>lemon tea</li> </ul> </li> <li>milk</li> </ul>
- green tea
- lemon tea
A list item can contain a new list in html, and it can also contain html elements like images, links and few other things as well.
Horizontal list with CSS: CSS can be used to style html lists in many different ways.