Change CSS rule at runtime

后端 未结 7 1675
清歌不尽
清歌不尽 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 20:54

    Add jQuery to your page. Then:

    $(function() {
        $('#mycss').css('background-color', '#FFFFFF');
        $('#mycss').css('padding', '10px');
    });
    

    Look up the documentation for the .css() method.

    But yeah, no one really knows what you mean by "runtime".

提交回复
热议问题