Clarify specificity as value - #44009
Conversation
There was a problem hiding this comment.
This sounds correct/better to me, but I'm not a CSS expert. @estelle Can you please look at this?
|
Preview URLs (1 page) Flaws (5) Found an unexpected or unresolvable flaw? Please report it here. URL:
(comment last updated: 2026-05-12 09:34:58) |
estelle
left a comment
There was a problem hiding this comment.
Thank you for the PR. This is a topic where we have to be super pedantic in translating something that is pretty complex. While the spec doesn't use the term "weight", to make people understand the topic, it makes sense to use that word. Similarly, the spec doesn't use columns or dashes, but, again, to make people understand, it makes sense to use those terms, but we can't say that that is how user agents do it. We also have to always be clear that specificity is only relevant within the a single origin layer (and scope?). I think my feed back does that.
Co-authored-by: Estelle Weyl <estelle@openwebdocs.org>
There was a problem hiding this comment.
Thank you, and congratulations on your first merged MDN content PR.
Just a pointer for future PRs:
When you want the reviewer to re-review a PR, click on the icon by their name in the reviewer section. This alerts the person that a PR is ready to be re-reviewed. The icon is the two arrows next to a bubble comments made icon (as shown in the screen shot) or a red page with a +/- changes requested icon (the green checkmark means "approved").
Clicking on the two arrows sends the reviewer an alerts, and changes the comment bubble or red +/- icon to a brown dot. This is another indicator that you are done editing and ready to have the PR re-visited.
Thanks. Welcome to the team!
| --- | ||
|
|
||
| **Specificity** is the algorithm used by browsers to determine the [CSS declaration](/en-US/docs/Learn_web_development/Core/Styling_basics/What_is_CSS#css_syntax_basics) that is the most relevant to an element, which in turn, determines the property value to apply to the element. The specificity algorithm calculates the weight of a [CSS selector](/en-US/docs/Web/CSS/Reference#selectors) to determine which rule from competing CSS declarations gets applied to an element. | ||
| **Specificity** is the weight that browsers use in the cascade algorithm to determine the [CSS declaration](/en-US/docs/Learn_web_development/Core/Styling_basics/What_is_CSS#css_syntax_basics) that is the most relevant to an element, which in turn, determines the property value to apply to the element. The specificity algorithm calculates this weight from a [CSS selector](/en-US/docs/Web/CSS/Reference#selectors), and compares the resulting values to decide which rule, from competing CSS declarations within the same origin and layer, gets applied to an element. |
There was a problem hiding this comment.
[mdn-linter] reported by reviewdog 🐶
| **Specificity** is the weight that browsers use in the cascade algorithm to determine the [CSS declaration](/en-US/docs/Learn_web_development/Core/Styling_basics/What_is_CSS#css_syntax_basics) that is the most relevant to an element, which in turn, determines the property value to apply to the element. The specificity algorithm calculates this weight from a [CSS selector](/en-US/docs/Web/CSS/Reference#selectors), and compares the resulting values to decide which rule, from competing CSS declarations within the same origin and layer, gets applied to an element. | |
| **Specificity** is the weight that browsers use in the cascade algorithm to determine the [CSS declaration](/en-US/docs/Learn_web_development/Core/Styling_basics/What_is_CSS#css_syntax_basics) that is the most relevant to an element, which in turn, determines the property value to apply to the element. The specificity algorithm calculates this weight from a [CSS selector](/en-US/docs/Web/CSS/Reference#selectors), and compares the resulting values to decide which rule, from competing CSS declarations within the same origin and layer, gets applied to an element. |
| Specificity is the weight that is applied to a given CSS declaration. The specificity algorithm calculates that weight based on the number of [selectors of each weight category](#selector_weight_categories) in the selector matching the element (or pseudo-element). If there are two or more declarations providing different property values for the same element, the declaration value in the style block having the matching selector with the greatest weight gets applied. | ||
|
|
||
| The specificity algorithm is basically a three-column value of three categories or weights - ID, CLASS, and TYPE - corresponding to the three types of selectors. The value represents the count of selector components in each weight category and is written as _ID - CLASS - TYPE_. The three columns are created by counting the number of selector components for each selector weight category in the selectors that match the element. | ||
| The specificity value is basically a three-column value of three categories or weights - ID, CLASS, and TYPE - corresponding to the three types of selectors. The value represents the count of selector components in each weight category and is written as _ID - CLASS - TYPE_. The three columns are created by counting the number of selector components for each selector weight category in the selectors that match the element. |
There was a problem hiding this comment.
[mdn-linter] reported by reviewdog 🐶
| The specificity value is basically a three-column value of three categories or weights - ID, CLASS, and TYPE - corresponding to the three types of selectors. The value represents the count of selector components in each weight category and is written as _ID - CLASS - TYPE_. The three columns are created by counting the number of selector components for each selector weight category in the selectors that match the element. | |
| The specificity value is basically a three-column value of three categories or weights - ID, CLASS, and TYPE - corresponding to the three types of selectors. The value represents the count of selector components in each weight category and is written as _ID - CLASS - TYPE_. The three columns are created by counting the number of selector components for each selector weight category in the selectors that match the element. |
Description
Clarifies that specificity is a value (weight) computed by the specificity algorithm and used in the cascade, removing wording that implied specificity itself is an algorithm.
Motivation
The current phrasing is conceptually inconsistent and can confuse readers. This makes the explanation more precise and aligns with how the cascade uses specificity values.
Additional details
N/A
Related issues and pull requests
Fixes #44000