4 ms·
This is all I need: :root{ var-myforecolor: red; var-mybackcolor: blue; } h1{ color: $myforecolor; background: $
by Kilimanjaro 14y ago
This is all I need:
:root{
var-myforecolor: red;
var-mybackcolor: blue;
}
h1{
color: $myforecolor;
background: $mybackcolor;
}
This covers 80% of all cases, leaving parent-vars and cascading-vars as edge cases. Good to have them just in case.
Bring it on!
- bkardell 14y agoComments to the author/editor of the draft and w3c itself are best directed on the blog itself.
- Steuard 14y agoCareful: as I understand it, the main point of this blog post is that they're going to update the spec to require, e.g., "color: var(myforecolor)" rather than "color: $myforecolor". (The rationale seems sensible to me, for what it's worth.)
- bkardell 14y agoYes, one of the primary things to realize is that this is not preprocessor style... its more like custom properties and a function for accessing the values of custom properties - in css, respecting everything else about css.
- deleted 14y ago[deleted]