-
I've always kind of intuited how
:nth-child(An+B)
worked in CSS but I kept confusing myself for n. So I wrote down the logic in a function (in JS to play/validate in DevTools):let nth = (i, a = 1, b = 0) => (i - b) % a === 0; // i is 1-indexed
I like it when it *clicks*.