{"id":274807,"date":"2018-12-05T07:38:34","date_gmt":"2018-12-05T14:38:34","guid":{"rendered":"http:\/\/css-tricks.com\/?p=274807"},"modified":"2018-12-06T08:26:54","modified_gmt":"2018-12-06T15:26:54","slug":"dry-switching-with-css-variables-the-difference-of-one-declaration","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/dry-switching-with-css-variables-the-difference-of-one-declaration\/","title":{"rendered":"DRY Switching with CSS Variables: The Difference of One Declaration"},"content":{"rendered":"
This is the first post of a two-part series that looks into the way CSS variables can be used to make the code for complex layouts and interactions less difficult to write and a lot easier to maintain. This first installment walks through various use cases where this technique applies. The second post<\/a> covers the use of fallbacks and invalid values to extend the technique to non-numeric values.<\/p>\n What if I told you a single CSS declaration makes the difference in the following image between the wide screen case (left) and the second one (right)? And what if I told you a single CSS declaration makes the difference between the odd and even items in the wide screen case?<\/p>\n