- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 19 Sep 2011 16:43:52 -0700
- To: fantasai <fantasai.lists@inkedblade.net>
- Cc: www-style@w3.org
On Mon, Sep 19, 2011 at 4:12 PM, fantasai <fantasai.lists@inkedblade.net> wrote: > On 09/19/2011 03:58 PM, Tab Atkins Jr. wrote: >> >> Summary >> ------- >> HTML is defining<style scoped> in a way which best matches author >> intuitions, but which is limited in some ways. I propose @global as a >> way to get around those limitations while maintaining the >> intuitiveness benefits. Hixie wrote an email explaining the relevant >> reasoning and suggesting this proposal at >> >> <http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-September/033222.html>. > > What's the use case for this, i.e. do we actually need to solve this > problem? A concrete use-case is provided at the very top of Hixie's email: <body class="archive"> ... <section> <style scoped> section > h1 { border-bottom: solid; } body.homepage h1 { color: red; } body.archive h1 { color: gray; } </style> <h1>Hello</h1> <!-- this changes colour based on whether it's on a page with <body class=homepage> or <body class=archive> --> <p>Welcome.</p> </section> ... </body> Here, you want to style just the given section, without styles leaking out into the rest of the document, thus you use <style scoped>. However, you want to change the styling of the <h1> based on context outside of the scope, in this case the class of the <body>. (Implicit in this example is the fact that the same section will be generated on multiple pages.) ~TJ
Received on Monday, 19 September 2011 23:44:48 UTC