Re: Scoped style sheets.

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">
   <style>
     div.username <users rule1> { ... }
     div.username <users rule2> { ... }
   </style>
   ... content ...
</div>

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

Thanks,

-- 
Andrew Fedoniouk.

http://terrainformatica.com

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