HTML <ul>
Tag: Creating Unordered Lists
The <ul>
(unordered list) tag in HTML is used to create a bulleted list. Each item inside the list is wrapped in an <li>
(list item) tag.
1. Basic Syntax
✅ Displays:
-
Apple
-
Banana
-
Cherry
2. Changing Bullet Styles with type
Attribute (Deprecated)
The type
attribute was used in older HTML versions but is now replaced with CSS.
✅ The modern approach uses CSS (list-style-type
).
3. Customizing List Styles with CSS
You can change the bullet style using list-style-type
:
✅ Common list-style-type
values:
-
disc
(●) - Default -
circle
(○) -
square
(■) -
none
(removes bullets)
4. Nested Lists (Lists Inside Lists)
You can create sublists by nesting <ul>
inside <li>
:
✅ Displays:
-
Fruits
-
Apple
-
Banana
-
-
Vegetables
5. Horizontal List (Inline List)
You can make the list items appear in a row using CSS:
✅ Displays as:
Home | About | Contact
6. Custom Bullets Using Images
You can replace default bullets with an image:
✅ Each item uses bullet.png
instead of the default circle.
7. Conclusion
-
The
<ul>
tag creates unordered (bulleted) lists. -
<li>
defines each list item. -
CSS can be used to customize bullet styles, alignment, and layout.