Why I'm Excited About Native CSS Variables
philipwalton.com
Why I'm Excited About Native CSS Variables
1–10 of 33 posts
Re: Why I'm Excited About Native CSS Variables
#2Re: Why I'm Excited About Native CSS Variables
#3Re: Why I'm Excited About Native CSS Variables
#4Re: Why I'm Excited About Native CSS Variables
#5I think this is the problem people have with them - they don't try to be a good solution to the problem people actually have. A better designed solution would have the most common case simple and elegant, and more esoteric use-cases, like the ones they are trying to solve, may have esoteric solutions like the proposed one.
Re: Why I'm Excited About Native CSS Variables
#6> In fact, I think it’s confusing to call them variables at all. They’re actually CSS properties, which gives them an entirely different set of capabilities and allows them to solve an entirely different set of problems. I think this is the problem people have with them - they don't try to be a good solution to the problem people actually have. A better designed solution would have the most common case simple and ele…
Re: Why I'm Excited About Native CSS Variables
#7What I am most excited about is manipulating these using javascript, which is also something you cannot do with a CSS processor because the values are baked into the CSS.
Re: Why I'm Excited About Native CSS Variables
#8Re: Why I'm Excited About Native CSS Variables
#9> In fact, I think it’s confusing to call them variables at all. They’re actually CSS properties, which gives them an entirely different set of capabilities and allows them to solve an entirely different set of problems. I think this is the problem people have with them - they don't try to be a good solution to the problem people actually have. A better designed solution would have the most common case simple and ele…
They really are a marvellous thing; my favourite example would be the construction of truly responsive interfaces, tweaked for optimality at many levels and continuous, rather than just things with three or four breakpoints; with preprocessors, it’s tedious and painful; with CSS variables it’s easy and obvious—it pushes you in a direction that is so much easier to make.
In essence, they are solving a substantially different set of problems, but one that is more useful and more general; the sorts of things people did with preprocessor variables can normally be done in better ways with CSS Variables; it helps guide you to a better position.
Re: Why I'm Excited About Native CSS Variables
#10These look neat. I wonder what they will be like to debug. I spend a lot of my job fixing problems that the designers have left in the CSS, like "Why on this page is the button margin 2em, but on all the other pages it's 1.5em." I guess with variables thrown into the mix, it'll make this debugging harder.
(I wish people would use `calc()` too where appropriate.)