Range selection patterns for CSS calendars

A clever CSS-Tricks piece showing how the newer :nth-child() “n of selector” syntax can handle date-range selection on a calendar with surprisingly little JavaScript.

Here’s the visual that shows how CSS can do date-range selection without quite losing its dignity.


Arthur

This is a nice pattern, but I’d still add a small JS fallback that just toggles . is-start/. is-end/. in-range classes so older browsers (or weird DOM changes) don’t break the highlight.

BobaMilk