Roma Komarov
Inventing weird CSS things.
CSSWG Member (previously: an invited expert).
Frontend engineer working on Datadog’s design system.
Ask me about: #CSS, #Frontend, #DesignSystems.
Located in France. He/him.
New blog post: “Fixing Baselines”.
https://blog.kizu.dev/fixing-baselines/
Do you know how to center things in CSS? In year 2025? Easy! You just… align… or justify…, ok, maybe just place? your content… or items? …Forget it, this post is not about alignment. Or is it?
This post is about another common alignment concept that might seem simple: baseline alignment. In it, I share a technique I have already used for twelve years.
> RESOLVED: make all property descriptors in @property optional
https://github.com/w3c/csswg-drafts/issues/13211#issuecomment-4040028009
Selectors in CSS are fast, but not when your app has too many DOM nodes and the selector in question is a non-optimal `:has()` — that can still introduce significant performance regressions in practice.
`:has()` should be your last resort — very often, using static templating or even JS instead could be a better idea.
Bad: `.foo:has(.bar)`
Ok: `.foo:has(> .bar)`.
Even the `:has() > …` should also be avoided with not precise selectors like `> *` or `> :first-child` — those can be bad too.
This time, going to #CSSDay on Tuesday and going back on Sunday because there will be a full-day pre-event and a post-event (https://cssday.nl/schedule.html).
It is almost a CSS Week now.
I don't know who needs to hear it, but I just test out an attempt to conditionally chain more than 10000 elements one to each other with anchor positioning, and in Chrome it works. Neither Safari nor Firefox don't currently work well with even a few chained elements, but, I guess, I now have a good benchmark :blobcatknife:
I was struggling to find a solution for a problem for a while.
Turns out, the solution was to double the number of scroll-driven animations I was using.
It would’ve been great to do this with fewer of them, but hey, I’ll take what I can.
@shoptalkshow So, about style-querying that light-dark()… https://blog.kizu.dev/querying-the-color-scheme/ :)
Decided to try matrix (for Nth time). For now, in a “lazy” mode: instead of looking for a good instance to join, using the “main” one for now.
@cinnyapp@fosstodon.org seems like the best client so far — custom emojis/stickers is a must when going from something like a discord/slack, and it works very well as an installed web app on the desktop/iOS so far.
If anyone wants to try chatting there — feel free to send me a DM here with your matrix address :)
Forgot to include in the stats that I encountered at least 5 bugs when implementing the mixing from the article — filled four (though one was a duplicate of another), and posted my test case into another pre-existing report. And there might've been bugs that I already knew about, so I just worked around them (like with all the tan(atan2()) stuff).
Ah, and also at least one bug that was only in an older version of a Chrome, but fixed in Canary, so did not report it.
@jakegiltsoff@mastodon.social @piccalilli@front-end.social @5t3ph@front-end.social It should be possible to adapt https://kizu.dev/fit-to-width/ to do this, but I don't have time to do it. Basically, if we know the lower and upper bounds of the wdth axis, we can add an extra step at the beginning. First, as usual, we render the font with the smallest font and wdth, then we can render it with the highest value of wdth and check if it still fits or overflows [1/2]
@jakegiltsoff@mastodon.social @piccalilli@front-end.social @5t3ph@front-end.social [2/2] If it fits -> we keep this value and continue growing as usual, otherwise apply only the wdth proportionally to the overflow value.
(I am assuming we will start from small and grow, as I strongly consider this the only proper way of handling this type of technique, and any shrinking variant can be expressed as growing anyways)
@darin@mas.to I mean, for those that shipped it — what is there should be already enough, this is a pretty basic thing for anchor positioning (likely requires position: fixed and maybe anchor-scope if there is a chance there could be multiple dialogs).
