All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.css.rules.css.S4664.html Maven / Gradle / Ivy

There is a newer version: 10.17.0.28100
Show newest version

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;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy