{"id":379002,"date":"2024-07-09T08:18:11","date_gmt":"2024-07-09T15:18:11","guid":{"rendered":"https:\/\/css-tricks.com\/?p=379002"},"modified":"2024-07-09T08:18:17","modified_gmt":"2024-07-09T15:18:17","slug":"if-css-gets-inline-conditionals","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/if-css-gets-inline-conditionals\/","title":{"rendered":"“If” CSS Gets Inline Conditionals"},"content":{"rendered":"\n

A few sirens went off a couple of weeks ago when the CSS Working Group (CSSWG) resolved to add an if()<\/code> conditional<\/a> to the CSS Values Module Level 5 specification. It was Lea Verou’s X post that same day that caught my attention:<\/p>\n\n\n\n

A historical day for CSS 😀🎉

If you write any components used and\/or styled by others, you know how huge this is!

background: if(style(–variant: success), var(–green));

Even if you don\u2019t, this will allow things like:
padding: if(var(–2xl), 1em, var(–xl) or var(–m),\u2026
pic.twitter.com\/cXeqwBuXvK<\/a><\/p>— Lea Verou (@LeaVerou) June 13, 2024<\/a><\/blockquote>