Change CSS rule at runtime

后端 未结 7 1661
清歌不尽
清歌不尽 2020-12-19 20:15

How do I change any CSS properties during runtime?
Suppose I have:

#mycss {
   background:#000;
   padding:0;
}

Then during runtime,

7条回答
  •  北海茫月
    2020-12-19 21:12

    There are multiple ways css rules can be overridden:

    • Any element will take on the css rule defined nearest to the bottom of the css document you include.
    • Any inline style will override the css rule defined in the css document.
    • Any javascript has the ability to dynamically adjust the css properties of any given element.
    • Any element can take on the property of !important, which defeats anything else defined.

提交回复
热议问题