覆盖css类
我有一个css类暂停。这适用于各种页面。只有一部分 加价不左边距:42px,所以我想将其设置为0px。我不想 使用一个新类,因为我正在使用jQuery动态应用这个类 某些条件 因此,我需要覆盖类以使左边距为:0px来自标记 css 加价覆盖css类,css,css-selectors,Css,Css Selectors,我有一个css类暂停。这适用于各种页面。只有一部分 加价不左边距:42px,所以我想将其设置为0px。我不想 使用一个新类,因为我正在使用jQuery动态应用这个类 某些条件 因此,我需要覆盖类以使左边距为:0px来自标记 css 加价 <td class="pause bid_button_logout bidder_name"> <a href="login"></a> </td> 如何中和任何其他类或任何其他方式留下的边距?如果
<td class="pause bid_button_logout bidder_name">
<a href="login"></a>
</td>
如何中和任何其他类或任何其他方式留下的边距?如果无法定义其他样式,请在不希望应用边距的元素上使用内联样式。内联样式比其他地方定义的样式更具体,因此应优先考虑:
如果要使用内联样式:
<a href="login" style="margin-left:0px;"></a>
但是这必须在
之后进行。暂停一个或者,如果您真的需要切换类,请参见尝试重要的hack:
margin-left: 0px !important;
您可以将.pause拆分为两个css类,其中一个只定义额外的边距,而不将该类应用于不需要边距的css类
或者像这样设置元素的style属性:style=“margin left:0;”
,这将覆盖css值
或者您可以创建另一个名为say“.noMargin”的类,如下所示:
.noMargin{ margin-left: 0 !important; }
/* important overrides other class values
even if the cascading would not */
把这个类应用到那些你不想有额外利润的类上 如果bid\u按钮\u注销
或bidder\u name
对于不需要保证金的情况是唯一的,则添加margin left:0px代码>到这些类中的任何一个(但要确保它们在之后。在css文件中暂停一个。如果没有,请使用条件jQuery添加一个内联样式,它将绕过原始的左边距样式。当我完成3种方法的编写后,每种方法都已经得到了其他几种方法的响应……谢谢您的快速响应
margin-left: 0px !important;
.noMargin{ margin-left: 0 !important; }
/* important overrides other class values
even if the cascading would not */