In HTML, there are two main types of lists: unordered lists ul
, which use bullets for each list item and ordered lists ol
, which use a numbering system.
- Maserati
- Alfa Romeo
- Ferrari
- Maserati
- Alfa Romeo
- Ferrari
- Maserati
- Alfa Romeo
- Ferrari
- Maserati
- Alfa Romeo
- Ferrari
HTML has limitations to styling a list (or anything really), so CSS is best used for styling the lists.
Changing a Lists Bullets/Numbers with CSS
As with any HTML element, the lists can be styled to change the text color, font, spacing, etc. But lists also use bullets and numbers to differentiate their list items. And using CSS we are given a wider variety of changing the bullets, including using images, or even removing them altogether.
Using Bullets and Numbers
ul {
list-style-type: square;
}
ol {
list-style-type: upper-roman;
}
These are the allowed values.
Value | Description |
---|---|
disc | The marker is a filled circle (default on unordered lists) |
armenian | The marker is traditional Armenian numbering |
circle | The marker is a circle |
cjk-ideographic | The marker is plain ideographic numbers |
decimal | The marker is a number (default on ordered lists) |
decimal-leading-zero | The marker is a number with leading zeros (01, 02, 03, etc.) |
georgian | The marker is traditional Georgian numbering |
hebrew | The marker is traditional Hebrew numbering |
hiragana | The marker is traditional Hiragana numbering |
hiragana-iroha | The marker is traditional Hiragana iroha numbering |
katakana | The marker is traditional Katakana numbering |
katakana-iroha | The marker is traditional Katakana iroha numbering |
lower-alpha | The marker is lower-alpha (a, b, c, d, e, etc.) |
lower-greek | The marker is lower-greek |
lower-latin | The marker is lower-latin (a, b, c, d, e, etc.) |
lower-roman | The marker is lower-roman (i, ii, iii, iv, v, etc.) |
none | No marker is shown |
square | The marker is a square |
upper-alpha | The marker is upper-alpha (A, B, C, D, E, etc.) |
upper-greek | The marker is upper-greek |
upper-latin | The marker is upper-latin (A, B, C, D, E, etc.) |
upper-roman | The marker is upper-roman (I, II, III, IV, V, etc.) |
initial | Sets this property to its default value |
inherit | Inherits this property from its parent element |
Using Images
ul {
list-style-image: url("my_marker.jpg");
}
Removing Bullets and Indentation
This keeps the list structure, but does away with the list look.
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
- Maserati
- Alfa Romeo
- Ferrari
List Properties
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.
Why 1SMARTchicken?
See More →
Thanks for your support!
CSS Books
All are affiliate links. Thank you for your support!
CSS NOTES:
- The “inherit”, “initial” and “unset” keywords can be used with any CSS property to set its value
- In CSS there are many ways to express a color value in a property
Feedback
If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.