Styling lists in CSS
Markers are their own little box now, addressable without a pseudo-element hack.
.steps {
list-style: decimal-leading-zero;
padding-inline-start: 2.5rem;
}
.steps li::marker {
color: #2b6cb0;
font-variant-numeric: tabular-nums;
font-weight: 600;
}
.checklist {
list-style: none;
padding: 0;
}
.checklist li::before {
content: "\2713\a0";
color: #16a34a;
}
How it works
list-stylesets the marker type, image and position in one go.::markerstyles the bullet or number itself.- A list used for layout should say so with
list-style: noneand a role.
Keywords and builtins used here
checklistcolorcontentpaddingremsteps
The run, in numbers
- Lines
- 20
- Characters to type
- 277
- Tokens
- 59
- Three-star pace
- 75 tpm
At the three-star pace of 75 tokens a minute, this run takes about 47 seconds.
Step 1 of 3 in Styling content, step 23 of 26 in Selectors & the box model.