如何使用jquery修改css中带有!important的样式属性

时间:2016-04-28    点击:157   

<div class="test">使用jquery修改css中带有!important的样式属性</div>

外部样式为:

div.test{
  width:auto !important;
  overflow:auto !important
}

通过 $("div.test").css("width","100px");和 $("div.test").css("width","100px !important");是无效的

要想修改div的width,可以通过如下这种方式:

$("div.test").css("cssText", "width:650px !important;");要想修改多个属性,可以这么做:

$("div.test").css("cssText", "width:650px !important;overflow:hidden !important");

以上这篇如何使用jquery修改css中带有!important的样式属性就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持本站。

Angular.js回顾ng-app和ng-model使用技巧
基于JS实现EOS隐藏错误提示层代码
第一章之初识Bootstrap
第二章之Bootstrap 页面排版样式
第三章之Bootstrap 表格与按钮功能
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved