This is Richard Jp Leguen's Typepad Profile.
Join Typepad and start following Richard Jp Leguen's activity
Join Now!
Already a member? Sign In
Richard Jp Leguen
Recent Activity
While I understand the desire for inheritance from one CSS rule to the next, it doesn't fit with the paradigm for CSS; a class attribute or id attribute isn't like specifying an instance of a class. It would create ambiguity about how rules apply or inherit: div#gloablNav .current { color:blue; } div#currentNav .current { color:red; } #main .intro a[href=/'] { .current; /* which rule does this inherit from? */ } Is the solution to this ambiguity to copy the entire CSS rule? #main .intro a[href="./"] { div#currentNav .current; } ... but CSS rules aren't unique, and the author (or maintainer) have no way of knowing in which CSS file this rule would have been defined, or if it is at all. And if this rule and another 'collide' how do I determine precedence? Can we make CSS stricter and demand uniqueness of selectors across all CSS files? No, because in web dev Forgiveness is the Default. The reality is that CSS isn't meant exclusively for developers and so it shouldn't support programming paradigms like inheritance or recursion or namespaces which are overwhelmingly familiar to developers. That doesn't mean, however, there isn't some method to CSS's madness; I'd worked and studied in web dev for quite some time before I discovered there was some kind of math behind the precedence of CSS rules, and it was a revelation and an eye opener;
Toggle Commented May 3, 2010 on What's Wrong With CSS at Coding Horror
Richard Jp Leguen is now following The Typepad Team
May 3, 2010