CSS provides styling options to customize lists (<ul>
, <ol>
, and <li>
) to enhance their appearance and readability.
List Type | Description | Example |
---|---|---|
Unordered List (<ul> ) |
Displays bullet points before list items. | • Item 1 • Item 2 |
Ordered List (<ol> ) |
Displays numbered items in order. | 1. Item 1 2. Item 2 |
Description List (<dl> ) |
Defines terms and descriptions. | Term: Definition |
list-style-type
)You can change the bullet or number style in lists.
ul {
list-style-type: square; /* Options: disc, circle, square, none */
}
ol {
list-style-type: upper-roman; /* Options: decimal, lower-alpha, upper-roman, etc. */
}
✔ Example Output:
Square Bullet List:
▪ Item 1
▪ Item 2
Roman Number List:
I. Item 1
II. Item 2
list-style: none;
)To remove default bullets or numbers:
ul, ol {
list-style: none; /* Removes bullets or numbers */
padding: 0;
margin: 0;
}
✔ Useful for custom navigation menus!
list-style-image
)You can use an image instead of bullets:
ul {
list-style-image: url("bullet.png");
}
✔ This replaces bullets with bullet.png
.
padding
& margin
)