By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

Boosting specificity

P: n/a
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.

Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Mon, 4 Oct 2004 10:54:31 -0400, "Harlan Messinger"
<h.*********@comcast.net> wrote:
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?


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

Jul 20 '05 #2

P: n/a
Steve Pugh <st***@pugh.net> wrote:
On Mon, 4 Oct 2004 10:54:31 -0400, "Harlan Messinger"
<h.*********@comcast.net> wrote:
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?


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?


--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #3

P: n/a
Steve Pugh <st***@pugh.net> wrote:
On Mon, 4 Oct 2004 10:54:31 -0400, "Harlan Messinger"
<h.*********@comcast.net> wrote:
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?


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?


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.
Jul 20 '05 #4

P: n/a
Harlan Messinger <hm*******************@comcast.net> wrote:
Steve Pugh <st***@pugh.net> wrote:
"Harlan Messinger"<h.*********@comcast.net> wrote:
If I want to give special priority to property values I want to declare for
a particular class,


Have you considered using !important?


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.


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

Jul 20 '05 #5

P: n/a
Steve Pugh <st***@pugh.net> wrote:

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.


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.
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.