org.sonar.l10n.css.rules.css.S4664.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-javascript-plugin Show documentation
Show all versions of sonar-javascript-plugin Show documentation
Code Analyzer for JavaScript/TypeScript/CSS
Order of instructions in CSS is important: instructions with equal specificity that occur later in the file take the priority. But when a selector
with a higher specificity (e.g. p a { color: green;}
) comes before the selector it overrides (e.g.: a { color: green;}
), the
priority is given to the first one. Even if it works properly, this is harder to anticipate the behaviour of the stylesheet while reading as it goes
against the principle that the last instruction takes the priority.
Noncompliant Code Example
p a {
color: green;
}
a {
color: blue;
}
Compliant Solution
a {
color: blue;
}
p a {
color: green;
}