CSS List Styles
Lists are a commonplace sight wherever you are; menus, lists of items, directions, footers, etc. We can now control how lists are styled in our documents with the CSS List Styles, we now have the ability to format items with bullet points, numbers, or position them anywhere on the page.
Types of HTML Lists
Before we style, let's quickly revisit the types of lists in HTML:
- Unordered List (
<ul>): A list with bullet points. - Ordered List (
<ol>): A list with numbers or letters. - Description List (
<dl>):A list of terms (<dt>)and their descriptions (<dd>).
Styling List Items with CSS
CSS has a great number of properties to style list items in remarkable ways. But the most usual used properties are:
list-style-typelist-style-positionlist-style-imagelist-style(shorthand)
list-style-type
This property controls the marker (bullet, number, or symbol) used in the list. It works with both ordered and unordered lists.
Unordered List Examples:
ul {
list-style-type: disc; /* default */
list-style-type: circle;
list-style-type: square;
list-style-type: none; /* remove bullet */
}
Ordered List Examples:
ol {
list-style-type: decimal; /* default */
list-style-type: lower-alpha;
list-style-type: upper-alpha;
list-style-type: lower-roman;
list-style-type: upper-roman;
}
list-style-position
This property defines where the marker appears — inside or outside the content box.
ul {
list-style-position: outside; /* default */
}
ul {
list-style-position: inside;
}
An outside places the marker outside the text box and an inside places it inside.
list-style-image
This property also lets you use a custom image instead of an icon or number as a list marker.
ul {
list-style-image: url('bullet.png');
}
If the image isn't available or loads, the browser defaults to the marker from list-style-type
list-style(Shorthand Property)
Rather than writing all properties independently, you can use list-style as a shorthand:
ul {
list-style: square outside;
}
ol {
list-style: upper-roman outside;
}
This combines list-style-type, list-style-position, and
list-style-image in
one declaration. There are times when value order matters.
Removing List Styling Completely
Sometimes you want to remove bullets or numbers — for example, when creating navigation menus:
ul {
list-style: none ;
margin: 0 ;
padding: 0 ;
}
Don’t forget to reset margin and padding for the cleanest layout.
Adding your own list markers
You can also use the ::before pseudo element to add your own icons or symbols.
li::before {
content: "✓" ;
color: green ;
font-weight: bold ;
margin-right: 0.5rem ;
}
This technique gives you full control over how each item is pronounced — great for checklists, icons, or arrows.
Styling Description Lists
Description lists use different tags:
<dl>– Description list container<dt>– Term<dd>– Description
dl {
background-color: #f9f9f9;
padding: 10px;
border-left: 5px solid #ccc;
}
dt {
font-weight: bold;
}
dd {
margin-bottom: 10px;
}
They can be styled as paragraphs, but do not use list-style-type because they do not a default
marker.
Stylish Practices for styling lists:
- Use semantic HTML — igniting a list item with an
<ul>for unordered,<ol>for ordered,<dl>for descriptions. - When creating nav menus or grid-based lists we can use:
list-style: none; - Be consistent with list markers for a clean, readable design.
- Use icons or pseudo-elements for an enhanced visual experience.
Conclusion: Turn Simple Lists into Design Elements
With CSS List Styles, you turn bulky HTML lists into beautiful, functional UI elements. Hardware be graphics, a great list can improve your sexual experience, give true fashion, whether a nav bar, a to-do list, or stylish-off-the-place bullet point list. When you master lists — a list is UI perfected.
So stop using bullets and numbers defaults — go out and make lists for your designer speak.