{"id":334015,"date":"2021-02-17T08:05:26","date_gmt":"2021-02-17T16:05:26","guid":{"rendered":"https:\/\/css-tricks.com\/?p=334015"},"modified":"2021-02-17T08:05:29","modified_gmt":"2021-02-17T16:05:29","slug":"css-switch-case-conditions","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/css-switch-case-conditions\/","title":{"rendered":"CSS Switch-Case Conditions"},"content":{"rendered":"\n

CSS is yet to have a switch<\/code> rule or conditional if<\/code>, aside from the specific nature of @media<\/code> queries and some deep trickery<\/a> with CSS custom properties. Let\u2019s have a look at why it would be useful if we did, and look at a trick that is usable today for pulling it off.<\/p>\n\n\n\n\n\n\n

Recent chatter about the possibility<\/h3>\n\n\n

While none of these things are usable today, there has been a good amount of chat about the concept of generic conditional CSS just in the last year:<\/p>\n\n\n\n