#202: Centered List Markers

Programming - Mar 31, 2024

Like so many things CSS, there is all sorts of little stuff to know, even something as minuscule as centering a list marker.

A reader wrote in with a screenshot of what they were trying to accomplish — basically an ordered list (<ol>) with the list markers (1., 2., 3., etc) on top of the list content and centered. In the screenshot, the text was centered, but the numbers were not. So, let’s get those numbers centered!

The first thing to know is that list-style-position needs to be inside. That’ll get the centering party started. If we have a break before the content, we’re pretty much there. In the video, we play with using the ::marker to do this, while finding limitations and exploring all the ideas.

This browser support data is from Caniuse, which has more detail. A number indicates that browser supports the feature at that version and up.

Desktop

ChromeFirefoxIEEdgeSafari
8668No8611.1

Mobile / Tablet

Android ChromeAndroid FirefoxAndroidiOS Safari
12212312211.3-11.4

Previous Next
Copyrights
We respect the property rights of others, and are always careful not to infringe on their rights, so authors and publishing houses have the right to demand that an article or book download link be removed from the site. If you find an article or book of yours and do not agree to the posting of a download link, or you have a suggestion or complaint, write to us through the Contact Us .
Read More