Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html

What is the <ul> element in HTML?

Talha Ashar

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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.

Attributes and events

The <ul> element includes only global attributes and supports all the usual events supported by HTML elements.

Example

The code below shows how the <ul> element works in HTML:

Explanation

The code above shows three different examples of how to use the <ul> element.

The first example in line 1111 creates a simple unordered list with 33 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 1919, 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 3636 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.

RELATED TAGS

html

CONTRIBUTOR

Talha Ashar
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring