Current music:
kinoue64 — 才能
Current drink:
Peppermint Tea

Originally, I wanted to write a bit bigger post about an alternative way of doing this technique, but I am kinda very tired today!

So! I just refer you to three places:

  1. The “Square-ish Layout” section of my “Possible Future CSS: Tree-Counting Functions and Random Values” article from 2024, in which I show how if we had children-count() we could easily make a layout that adapts to the number of children through its number of columns being essentually a square root of their count. Also, how exciting — everything I wrote about in this article is now in browsers in one way or another — sibling-count() and sibling-index() are baseline available, and random() is almost there, with only Firefox not having it in the stable version (but — already in Nightly).

  2. A recent article from Temani Afif — “Transferring sibling-count() to a Parent Element”, where he links to my above article and re-implements that square-ish layout with his technique!

  3. My CSS Working Group issue with a children-count() proposal — I think we really need it! There are many use cases! This one is pretty mild, but I found it be pretty fun. If this is something that you also want — please, vote in this issue, and provide your use cases!

That’s it. That’s the post. I need to learn to do more small posts like these, maybe even not in November.


Let me know what you think about this on Mastodon!