We've recently introduced the possibility of new starters borrowing some of our old kit. A couple of factors have prompted this: we've found that beginners prefer using wooden takedown bows rather than the fancy aluminium ILF kit we purchased a few years - we don't know why; the feel of wood is nicer I guess, and the weight of the bow is lighter (people seem less inclined to lift heavy weights after the pandemic) - the other reason is that we can't be bothered popping stuff onto eBay and figuring out postage and all that stuff.
This means we need a way of recording our kit and who has it, so rather than killing another spreadsheet, I've added it to our web application. Using React Bootstrap, we have cards available, so each kit has a card, sometimes with images. But displaying the details of the kit is awkward. Adding and editing are easy, as I'm a fan of simple forms, but showing it is less straightforward and likely to take up a lot of space, so I thought about using CSS columns; so far, so good!
But it's responsive, so we need to alter the number of columns depending on the screen's width—which isn't helped by my adding a sidebar on broader screens. When the screen hit a specific width and the menu switched to the side, we were left with a hinterland situation when I used media queries on the whole document. What was once extensive in the main content ended up shrinking, thus affecting the columns' layout: I needed container queries, something I read about a little while ago and bookmarked.
After reading the article by Josh W Comeau (A Friendly Introduction to Container Queries) I knew how to do it too:
.responsive_multi_columns { container-type: inline-size; .columns { column-count: 1; column-gap: 0; dd { break-before: avoid-column; } @container (min-width: 36rem) { // 576px (sm) column-count: 2; column-gap: .25rem; } @container (min-width: 48rem) { // 768px (md) column-count: 3; column-gap: .5rem; } @container (min-width: 60rem) { // 960px (lg) column-count: 4; column-gap: 1rem; } @container (min-width: 75rem) { // 1200px (xl) column-count: 5; column-gap: 2rem; } @container (min-width: 87.5rem) { // 1400px (xxl) column-count: 6; column-gap: 2rem; } } }
What was annoying, though, was the tendency for the definition list to break at what I found to be wrong places; this was solved by adding break-before: avoid-column;
to the dd
element - that worked a treat!