HTML and CSS Reference
In-Depth Information
There is also the !important declaration to consider in the cascade. This
declaration is used to balance the relative priority of user and author style
sheets. While author style sheets take precedence over user ones, if a user
rule has !important applied to it, it will override even an author rule that
also has !important applied to it.
Knowing this, let's look at the final order, in ascending order of importance:
1.
User agent declarations,
2. User declarations,
3. Author declarations,
4. Author !important declarations,
5. User !important declarations.
This flexibility in priority is key because it allows users to override styles that
could hamper the accessibility of a website. (A user might want a larger font
or a di " erent color, for example.)
2. Specificity
Every CSS rule has a particular weight (as mentioned in the introduction),
meaning it could be more or less important than the others or equally
important. This weight defines which properties will be applied to an
element when there are conflicting rules.
Upon assessing a rule's importance, the cascade attributes a specificity to it;
if one rule is more specific than another, it overrides it.
If two rules share the same weight, source and specificity, the later one is
applied.
Search WWH ::




Custom Search