How to apply !important in CSS? (original) (raw)

Last Updated : 11 Jul, 2025

The !important rule in CSS is used to add more importance to a property/value than normal. It forces a style to override any other declarations, ensuring the specified property value is applied, regardless of specificity. It helps resolve conflicts but should be used sparingly to avoid complicating stylesheet management.

**Syntax:

element {
color: blue !important;
font-size: 14px !important;
...
}

**Example 1: In this example, we use CSS to set a

color to white with !important, overriding blue. The body has a yellow background, despite a green !important due to later definition.

HTML `

Document