我在覆盖某些插件CSS方面遇到了问题。直接编辑CSS实际上不是一个选项,因为它会使更新插件更具风险。
问题:元素具有绝对定位,并且在原始元素中具有顶部:0px。我想通过底部覆盖它:0px。
为了举例
.element {position:absolute; top:0;}
/* in another file */
.my .element {bottom:0;}
在firefox上运行正常(底部:0是应用的样式),但是safari / chrome似乎没有超过顶部:0。
我可以解决这个问题,但提出一个干净的解决方案会很好。
答案 0 :(得分:182)
使用top: auto
将top
重置为initial value。
bottom
是与top
(an element can have both a top
and bottom
)完全独立的属性,因此您可能不再需要bottom
。
另外,请确保您的覆盖选择器为specific enough,但在这种情况下听起来不是问题。
答案 1 :(得分:5)
.my .element { position: inherit !important; top: auto; }