After years of developer frustration and questions on online forums, it’s finally happening: CSS is getting an if() function to apply styling when a condition is met. For the first time, developers can make logical decisions directly in stylesheets, without separate code blocks. This opens up whole new possibilities for web designers.
What an abomination
I’m just curious what kind of bad code is going to be around when this gets widespread.
No worries, we really bad web developers have all switched to React long ago 😎 So no CSS here, just Material-UI’s “sx” attribute plastered over every single component.
This breaks with the foundations of CSS. You already can build if-like statements especially since the implementation of custom properties. It doesn’t have to be that explicit — quite the contrary: putting if() into every property will make them bloated and harder to understand.
Only in Chromium for now. Also I don’t see how it adds any new capabilities? I guess it is a little nicer syntax wise in some cases, but I might still prefer SCSS nested declarations instead.

Slow-walk to plain scripting.
It should be like CSS5 by now with all the stuff they’ve added
After CSS3 they switched to rolling releases and dropped any numbers, AFAIK.
Since flexbox I haven’t seen any useful updates to css.
This just gatekeeps alternative browsers from taking part.
I would argue grid, :has(), var(), and native nesting have been just as important steps forward.
When was the last time a feature this huge was added to CSS?
.foo { .nested { property: value; } }Quite regularly, tbh.
@containerand@scopewere pretty big in my opinion.
O.M.G. Finally!!!
JSSS had this 30 years ago!
what
When <if cond=“true”></if> and <set var=“x” val=“lol”>?
Can’t wait to have business logic in my CSS!
That is HTML not CSS
Yeah, that’s the point… CSS has conditionals now, so when will we get HTML conditionals and variables?








