CSS

[CSS] CSS / Basics /! Important

OOQ 2022. 7. 28. 15:56
728x90
SMALL

#css

If CSS defines the same attribute multiple times, the value set later will be applied. To prevent later settings from being applied, add! Important after the attribute value.

property: value !important;

For example, next time the last set color value is blue, so ignore red and make the paragraph text color blue.

p {
  color: red;
}
p {
  color: blue;
}

But next time there is a! Important in red, so I keep the text color of the paragraph red.

p {
  color: red !important;
}
p {
  color: blue;
}

If you want to reset the attribute value again, add! Important again. For example, the next step is to change the text color of the paragraph to green.

p {
  color: red !important;
}
p {
  color: blue;
}
p {
  color: green !important;
}

 

728x90
LIST