如何使用jQuery从CSS类中删除一些规则? [英] How to remove some rules from css class using jquery?

查看:80
本文介绍了如何使用jQuery从CSS类中删除一些规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下的CSS类,

I have a css class like below,

.myclass
{
    border-collapse: collapse;
    border-style: solid;
    border-width: 1px 1px 0 0;
    display: table-cell;
    line-height: 0.3em;
    overflow: hidden;
    padding: 0.7em;
    white-space: nowrap;
}



我想从css class(myclass)中删除line-height:0.3em,white-space:nowrap.



I want to remove line-height : 0.3em, white-space : nowrap from the css class(myclass). How to do this using jquery?

推荐答案

最合理的方法是拥有两组CSS,然后逐页应用所需的CSS.但是,当google在我居住的地方工作时,我发现了 [ ^ ],看起来它应该会有所帮助.
The most sane way to do this is to have two sets of CSS and apply the ones you want from page to page. However, as google works where I live, I found this[^], which looks like it should help.


您可能想使用css函数修改现有的CSS属性,并指定该属性的默认值.或如Christian所说,创建2套CSS,然后使用toggleClass从一个类切换到另一个类.
You might want modify the existing css attribute using the css function and specify the default values for the attributes. Or as Christian said, create 2 sets of CSS, and then use toggleClass to switch from one class to the other.


这篇关于如何使用jQuery从CSS类中删除一些规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆