让css样式失效的方法:1、通过更改元素名称,来达到让此区域css失效的目的;2、通过设置优先级高的css样式来覆盖此css样式使其失效。
本教程操作环境:windows7系统、css3版,DELL G3电脑。
让css样式失效的方法:
一、通过更改元素名称,来达到让此区域css失效的目的
如我们已经为#notice设置了如上的单独样式,可以通过更改元素#notice的名称来取消样式
$(function() {
$("#notice").attr("id", "notice00");
});
二、通过设置优先级高的css样式来覆盖此css样式使其失效
使用!important提升样式优先级。/p>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Untitled Document.aa{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
background-color: #FF0000 !important
}
.bb{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
background-color: #FF0000;
}
中Class中包括:!important的样式
不包括的样式
效果图:
相关教程推荐:CSS视频教程