CSS list-style
- type
- shorthand property
- applies to
- <ul>, <ol>, <li>
- inherits
- yes
- common values
- none; disc | circle | square | decimal | lower-alpha; inside | outside
Where it goes
On the <ul> or <ol>. It passes down to the <li> tags. Nav lists almost always get list-style: none plus margin: 0; padding: 0 to drop the default indent.
Example
nav ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
gap: 16px;
}
ol.steps { list-style: decimal inside; }Common mistakes
- Removing the bullets and forgetting the default padding-left. The list still sits indented 40px. Reset padding and margin as well.
- Removing the bullets and then removing the <ul> as "pointless." Keep the list tags. It is still a list; only the look changed. Safari drops list meaning when list-style is none, and role="list" restores it.
- Trying to color the bullet with color. That colors the text too. Use li::marker { color: tomato; }.