Friday, 18 May 2018

Custom List Number Styling

How about a classic CSS trick! This isn't even so tricky anymore, since CSS has counter-increment and counter-reset and such that is perfect for this. I just wanted to make sure you knew how it works and had some easy-to-copy examples at the ready.

Let's say all you wanna do is style the dang numbers:

See the Pen Custom List Style 2 by Chris Coyier (@chriscoyier) on CodePen.

Here's an example from the CodePen Challenges pages:

See the Pen Custom List Counters by Chris Coyier (@chriscoyier) on CodePen.

The keyframers made a Pen the other day that used pretty cool styles. Here's a redux:

See the Pen Custom List Style 3 by Chris Coyier (@chriscoyier) on CodePen.

Recipe sites are great places to look for custom list styles, as lists of steps are such a prevelant feature. On Mat Marquis' site, he's got some fun ones. I ripped off his CSS and moved it here:

See the Pen Wilto Counters by Chris Coyier (@chriscoyier) on CodePen.

Make sure to check out the fun little media query change. Lea Verou's food site, of course, has counter-based numbering as well.

Here's an interesting demo from Jonathan Snook that has a "timeline" look and uses custom counters to label each section:

See the Pen Timeline CSS with Counters by Jonathan Snook (@snookca) on CodePen.

More Information

The post Custom List Number Styling appeared first on CSS-Tricks.



from CSS-Tricks https://ift.tt/2KD3e8y
via IFTTT

No comments:

Post a Comment

Passkeys: What the Heck and Why?

These things called  passkeys  sure are making the rounds these days. They were a main attraction at  W3C TPAC 2022 , gained support in  Saf...