Charlotte came up with a nifty trick that combines two different techniques she’s been working with.
The first building block is the pattern of using checkboxes, labels, and the :checked
pseudo-class to create progressive disclosure toggles without JavaScript. There’s just one caveat with that technique though—the item being toggled must appear after the trigger label in the source order of the markup.
Enter the second building block: flexbox. With flexbox, we’re no longer at the mercy of the source order in our markup. By using flex-direction: column-reverse
, the progressive disclosure trigger can be displayed after the item being toggled.