org.sonar.l10n.css.rules.css.S4651.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
linear-gradient
was standardized with CSS3. Before that, it was possible to use different non-standard values to define the gradient’s
direction. Because these values are not standard, they are not supported in all browsers and therefore they should no longer be used in order to get
the expected gradient in the latest browser versions that support CSS3.
This rule raises an issue when the first parameter of a linear-gradient
is not a valid <side-or-corner>
or
angle
.
Noncompliant Code Example
.foo {
background: -webkit-linear-gradient(to top, #fff, #000);
background: linear-gradient(top, #fff, #000);
}
.bar {
background: linear-gradient(45, #fff, #000);
}
Compliant Solution
.foo {
background: -webkit-linear-gradient(top, #fff, #000);
background: linear-gradient(to top, #fff, #000);
}
.bar {
background: linear-gradient(45deg, #fff, #000);
}
See
- Mozilla Web Technology for Developers -
linear-gradient