http://news.ycombinator.com/item?id=3162221
(which links to through to a www-style list discussion from October 24: http://lists.w3.org/Archives/Public/www-style/2011Oct/0699.h...)
(which links to through to a www-style list discussion from October 24: http://lists.w3.org/Archives/Public/www-style/2011Oct/0699.h...)
.element {
color: #06c;
border-color: #006;
}
h1 {
apply: .element;
border-style: thick;
border-width: solid;
}
This will make H1 "pretend" that it has .element class applied to it, even though in HTML source code it doesn't. I think it's a conceptually simple and orthogonal solution. True variables differ from the current metality of CSS way too much.Not terribly clear as to why we need specific functionality for inheritance when we already have an expressive way of defining it.
.data {
font-size:11px;
font-family:Courier;
color: #555;
}
.magic {
color: royalBlue;
}
<p class="data magic">Magical data</p>
<p>Normal text with <span class="magic">magical <span class="data">data</span></span>.</p>
I've inherited .magic into .data without sacrificing the ability to use .magic and .data by itself. As long as you keep your CSS classes semantic and disperse them intelligently into the markup, it's really not an issue of making large scale changes with minimal effort. Of course, in practice, this isn't always the case, but I think adding more ways to inherit properties will increase complexity more than help write good styles.I think the outcry for these features is a symptom of a poor understanding of the cascade and the language. There are much larger issues I'd like to see addressed, like the wide adoption of layout definitions which has better rules for defining vertical positioning and more fluid widths, both of which are pretty nightmarish without resorting to tables.