Skip to content

VBC-032: css-important ​

warning

Category: core
Analysis: Regex (line by line)
File types: .css, .scss, .less
Scope: source code only, ignoring anything inside strings and comments
Excluded selectors: @media (prefers-reduced-motion, @media print
Tags: style css

What it reports ​

Global '!important' detected in CSS at line {line}. This breaks the cascade.

Flagged ​

css
.card { color: red !important; }
css
@media (min-width: 600px) {
  .card { color: red !important; }
}
css
@media screen {
  .card { margin: 0 !important; }
}

Not flagged ​

css
.card { color: red; }
css
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
css
@media print {
  .nav { display: none !important; }
}

Pattern ​

regex
!important

Released under the MIT License.