禁用css选择器的所有属性

时间:2014-01-24 12:53:53

标签: css

我有一条css规则

    .lp-caption {
      -moz-border-bottom-colors: none;
      -moz-border-left-colors: none;
      -moz-border-right-colors: none;
      -moz-border-top-colors: none;
      background-attachment: scroll;
      background-clip: border-box;
      background-color: #FCFCFC;
      background-image: none;
      background-origin: padding-box;
      background-position: 0 0;
      background-repeat: repeat;
      background-size: auto auto;
      border-bottom-color: #EEEEEE;
      border-bottom-left-radius: 5px;
      border-bottom-right-radius: 5px;
      border-bottom-style: solid;
      border-bottom-width: 1px;
      border-image-outset: 0 0 0 0;
      border-image-repeat: stretch stretch;
      border-image-slice: 100% 100% 100% 100%;
      border-image-source: none;
      border-image-width: 1 1 1 1;
      border-left-color-ltr-source: physical;
      border-left-color-rtl-source: physical;
      border-left-color-value: #EEEEEE;
      border-left-style-ltr-source: physical;
      border-left-style-rtl-source: physical;
      border-left-style-value: solid;
      border-left-width-ltr-source: physical;
      border-left-width-rtl-source: physical;
      border-left-width-value: 1px;
      border-right-color-ltr-source: physical;
      border-right-color-rtl-source: physical;
      border-right-color-value: #EEEEEE;
      border-right-style-ltr-source: physical;
      border-right-style-rtl-source: physical;
      border-right-style-value: solid;
      border-right-width-ltr-source: physical;
      border-right-width-rtl-source: physical;
      border-right-width-value: 1px;
      border-top-color: #EEEEEE;
      border-top-left-radius: 5px;
      border-top-right-radius: 5px;
      border-top-style: solid;
      border-top-width: 1px;
      box-shadow: 0 0 3px #EEEEEE;
      max-width: 100%;
      padding-bottom: 0;
      padding-left: 10px;
      padding-right: 0;
      padding-top: 10px;
    }

我无法更改CSS样式表,但我可以通过其他方式应用css更改。所以我想让html完全忽略这个选择器的所有规则.lp-caption。

我有什么方法可以像.lp-caption{none}

那样做

2 个答案:

答案 0 :(得分:4)

无法删除它们,您必须根据需要覆盖每个属性。你可以为这个元素添加类(使用javascript)并为该类定义不同的css规则。

答案 1 :(得分:1)

我猜这是一种丑陋的做法:

.lp-caption {
padding: 0px;
margin: 0px;
border: none;
background-image: none;
background-color: transparent;
}