Articles Tagged
counters()
counters()
function can combine multiple lists into a single list. So, if you have two active counters on the page, counters()
can be used to combine them so that the list numbers are used to count the items in both lists together. counter()
counter()
function takes the number (or symbol) of a list item and makes it available to display outside the list. In other words, it makes things that aren't lists look like lists. For example, we can take the current list number of an existing list counter, format it as a Roman numeral, then display it in front of a heading: Some Things You Might Not Know About Custom Counter Styles
I was reading through Juan’s recent Almanac entry for the @counter-style
at-rule and I’ll be darned if he didn’t uncover and unpack some extremely interesting things that we can do to style lists, notably the list marker. You’re probably already …
@counter-style
The @counter-style
at-rule lets you create custom list counters that can be used in the list-style-type
property and the counter()
and counters()
functions. It also allows for extending existing counter styles.…
Remove List Markers Without Affecting Semantics
:where(ul, li, menu) {
list-style: "";
}
The more “correct” approach is to set list-style
to none
but that has a latent consequence of Safari no longer recognizing the element as a proper list, semantically speaking. We could fix …
Everything You Need to Know About the Gap After the List Marker
I was reading “Creative List Styling” on Google’s web.dev blog and noticed something odd in one of the code examples in the ::marker
section of the article. The built-in list markers are bullets, ordinal numbers, and letters. The ::marker
pseudo-element …
Newer Things to Know About Good Ol’ HTML Lists
HTML lists are boring. They don’t do much, so we don’t really think about them despite how widely used they are. And we’re still able to do the same things we’ve always done to customize them, like removing markers, reversing …
A Perfect Table of Contents With HTML + CSS
Earlier this year, I self-published an ebook called Understanding JavaScript Promises (free for download). Even though I didn’t have any intention of turning it into a print book, enough people reached out inquiring about a print version that …