Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 21st, 2005, 12:55 AM
Harlan Messinger
Guest
 
Posts: n/a
Default Boosting specificity

If I want to give special priority to property values I want to declare for
a particular class, should

.myclass.myclass.myclass.myclass.myclass.myclass.m yclass.myclass.myclass
{ /* declarations */ }

have that effect?

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.

  #2  
Old July 21st, 2005, 12:55 AM
Steve Pugh
Guest
 
Posts: n/a
Default Re: Boosting specificity

On Mon, 4 Oct 2004 10:54:31 -0400, "Harlan Messinger"
<h.messinger@comcast.net> wrote:
[color=blue]
>If I want to give special priority to property values I want to declare for
>a particular class, should
>
> .myclass.myclass.myclass.myclass.myclass.myclass.m yclass.myclass.myclass
>{ /* declarations */ }
>
>have that effect?[/color]

Hmm, http://www.w3.org/TR/CSS21/cascade.html says "count the number of
other attributes and pseudo-classes in the selector" - nothing about
whether they need to be unique or not.

But I wouldn't be at all surprised if at least some browsers did
strange things.

Have you considered using !important?

Steve

  #3  
Old July 21st, 2005, 12:55 AM
Harlan Messinger
Guest
 
Posts: n/a
Default Re: Boosting specificity

Steve Pugh <steve@pugh.net> wrote:
[color=blue]
>On Mon, 4 Oct 2004 10:54:31 -0400, "Harlan Messinger"
><h.messinger@comcast.net> wrote:
>[color=green]
>>If I want to give special priority to property values I want to declare for
>>a particular class, should
>>
>> .myclass.myclass.myclass.myclass.myclass.myclass.m yclass.myclass.myclass
>>{ /* declarations */ }
>>
>>have that effect?[/color]
>
>Hmm, http://www.w3.org/TR/CSS21/cascade.html says "count the number of
>other attributes and pseudo-classes in the selector" - nothing about
>whether they need to be unique or not.
>
>But I wouldn't be at all surprised if at least some browsers did
>strange things.
>
>Have you considered using !important?[/color]



--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.
  #4  
Old July 21st, 2005, 12:55 AM
Harlan Messinger
Guest
 
Posts: n/a
Default Re: Boosting specificity

Steve Pugh <steve@pugh.net> wrote:
[color=blue]
>On Mon, 4 Oct 2004 10:54:31 -0400, "Harlan Messinger"
><h.messinger@comcast.net> wrote:
>[color=green]
>>If I want to give special priority to property values I want to declare for
>>a particular class, should
>>
>> .myclass.myclass.myclass.myclass.myclass.myclass.m yclass.myclass.myclass
>>{ /* declarations */ }
>>
>>have that effect?[/color]
>
>Hmm, http://www.w3.org/TR/CSS21/cascade.html says "count the number of
>other attributes and pseudo-classes in the selector" - nothing about
>whether they need to be unique or not.
>
>But I wouldn't be at all surprised if at least some browsers did
>strange things.
>
>Have you considered using !important?[/color]

It came to mind, but I double-checked what it really means and, if I'm
understanding the spec correctly, it only has to do with altering the
balance between author and user style sheets.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.
  #5  
Old July 21st, 2005, 12:55 AM
Steve Pugh
Guest
 
Posts: n/a
Default Re: Boosting specificity

Harlan Messinger <hmessinger.removethis@comcast.net> wrote:[color=blue]
>Steve Pugh <steve@pugh.net> wrote:
>"Harlan Messinger"<h.messinger@comcast.net> wrote:[color=green]
>>[color=darkred]
>>>If I want to give special priority to property values I want to declare for
>>>a particular class,[/color]
>>
>>Have you considered using !important?[/color]
>
>It came to mind, but I double-checked what it really means and, if I'm
>understanding the spec correctly, it only has to do with altering the
>balance between author and user style sheets.[/color]

Not only.

An !important rule in an author stylesheet over rides all conflicting
rules that do not have !important in any author or user stylesheet
regardless of specificity, position in the cascade, or position within
the stylesheet. I sometimes use to over ride rules of equal
specificity that have to be specified earlier (i.e. via @include).

An !important in a user stylesheet over rides all conflicting rules in
all other stylesheets.

The order is:
user !important
author !important
author
user
_Within_ those categories the rules of specificity apply.

Steve

  #6  
Old July 21st, 2005, 12:56 AM
Harlan Messinger
Guest
 
Posts: n/a
Default Re: Boosting specificity

Steve Pugh <steve@pugh.net> wrote:
[color=blue]
>
>An !important rule in an author stylesheet over rides all conflicting
>rules that do not have !important in any author or user stylesheet
>regardless of specificity, position in the cascade, or position within
>the stylesheet. I sometimes use to over ride rules of equal
>specificity that have to be specified earlier (i.e. via @include).
>
>An !important in a user stylesheet over rides all conflicting rules in
>all other stylesheets.
>
>The order is:
>user !important
>author !important
>author
>user
>_Within_ those categories the rules of specificity apply.[/color]

OK, thanks, I see that now. I had read through the spec too hastily
before.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles