W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Scoped style sheets.

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Tue, 15 Jul 2008 19:26:25 -0700
Message-ID: <487D5C51.9020500@terrainformatica.com>
To: Ian Hickson <ian@hixie.ch>
CC: David Hyatt <hyatt@apple.com>, Lachlan Hunt <lachlan.hunt@lachy.id.au>, www-style <www-style@w3.org>

Ian Hickson wrote:
> On Mon, 14 Jul 2008, Andrew Fedoniouk wrote:
>> Normal specificity rules will simply not work.
>> To be able to overweight global styles you will end
>> up with something like this:
>> <style>
>>   body.foo #content p { color:red; }
>> </style>
>>  <body>
>>    <div #content>
>>      <style scoped>
>>          body.foo #content p { color:green; }
>>      </style>
>>      <p>what would be the color of this text?</p>
>>   </div>
>> </body>
> I don't think this is really realistic. If <div id="content"> is imported
> from another source, why would the doc style sheet attempt to style it if 
> the importing source is going to override it?
> In fact, I'd suggest that it's the parent doc that is the one that is 
> going to want to override styles. For that, this mechanism works fine.

As far as I understand global styles and scoped ones are supposed to 
come from different sources. Someone before provided example about
user' style sheets on social network portals. Portal designers and users 
have little mutual knowledge about their style sets.

In this case if user will want to override default styles of the portal 
then  he/she *must* to use as full path for styling as possible - to
give more specificity to his/her CSS rules.
And these sheets will break if portal authors will decide to change
anything. Portal designers will never be sure about their styling 
system. One day their rules will override users sheets, next day - users 
will win.

So is my question again: what is the purpose of such peculiar style 
system organization?

As far as understand you it is just enough to prepend each style
rule in that scoped thing by something like:

<div class="username">
     div.username <users rule1> { ... }
     div.username <users rule2> { ... }
   ... content ...

and you will have what you want. It works already so why that <style 
scoped> there at all?


Andrew Fedoniouk.

Received on Wednesday, 16 July 2008 02:27:00 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:38 UTC