When to use “!important” to save the day (when working with CSS)

前端 未结 7 1863
北海茫月
北海茫月 2020-12-04 02:10
#div p {
    color: red !important;
}
...
#div p {
    color: blue;
}

I understand how !important works, in this case the div will ren

7条回答
  •  一整个雨季
    2020-12-04 02:30

    If your page includes multiple CSS files, the CSS written by you, and additional CSS that go with software written by other parties, you may want some of your CSS marked !important to "guarantee" it will not be overridden by CSS from other included files.

提交回复
热议问题