If you have a CSS rule with !important and another rule with higher specificity targeting the same element, which one will take precedence?
- Both rules will be applied
- The order in the stylesheet
- The rule with !important
- The rule with higher specificity
If a CSS rule has the !important declaration, it takes the highest precedence, regardless of the specificity of other rules. The !important rule will override any conflicting rule, even if it has a higher specificity.
Loading...
Related Quiz
- Which CSS property specifies whether an animation should play in reverse on alternate cycles?
- Suppose you want to target every third list item in a list. Which CSS pseudo-class will you use?
- You want to set a global color scheme for a website using CSS variables. Where would be the best place to define these custom properties?
- If you want list items to display horizontally rather than vertically, the CSS property to adjust is ________.
- Which CSS property is used to vertically align inline elements or inline-block elements?