- From: Matthew Wilcox <elvendil@gmail.com>
- Date: Thu, 5 Jan 2012 17:08:56 +0000
- To: "Oliver St. John" <osj@cbord.com>
- Cc: "www-style@w3.org" <www-style@w3.org>
I think it's so powerful because it stops styling relying on the mark-up structure. If you can reference outside of the current element and it's immediate ancestors you're no longer trapped with having to author exactly nested mark-up to meet a style requirement. That, to me, make it worth serious effort/consideration. Our reliance on the cascade alone is the biggest flaw we have in CSS, in my opinion. (The Cascade is essential and genius, but it's not enough to allow true separation of the web-design layers jobs). We'd have to think about sensible strategy as you say. For example, elements that reference each other should go with the largest shared value: e.g., div#one { height: #two; } div#two { height: #one; } would ensure equal height columns, but to whichever is the greatest height after content is inserted. That's a rather simple syntax and might be limiting, so perhaps a construct like: get(SELECTOR, ATTRIBUTE) might work well. E.g., div#one { height: get('#two', width); } //sets div#one height to div#two width. You could even combine with Calc: div#one { height: calc(get('#two', width) / 2); } // makes div#one half the width of div#two For layout, I think it'd be incredible to be able to reference another elements property. e.g., move div#one 20px offset from div#two, regardless of the mark-up structure: div#one { position: #two; left: 20px; top: 20px; }
Received on Thursday, 5 January 2012 17:09:29 UTC