What browsers support “!important”?

前端 未结 4 2050
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 17:43

Which browsers support the CSS !important directive, and what are the various quirks amongst the different browsers that do support it?

4条回答
  •  失恋的感觉
    2020-12-15 18:09

    All browsers apart from IE6 support it which makes it quite handy for CSS hacks. Example:

    #someElement { width:200px !important; width:198px; }
    

    All browsers apart from IE6 will render #someElement at 200px because they will honor the !important. IE6 however will just ignore the !important and render #someElement at 198px.

    EDIT: Most common use case scenario for this (at least with me) is using it to correct the double margin bug in IE6

提交回复
热议问题