我在覆盖某些插件 CSS 时遇到问题。直接编辑 CSS 并不是一个真正的选择,因为这会使更新插件的风险更大。
问题:一个元素有绝对定位,原来有top:0px。我想用 bottom:0px 覆盖它。
为了举例
.element {position:absolute; top:0;}
/* in another file */
.my .element {bottom:0;}
在 firefox 上这工作正常(底部:0 是应用的样式),但 safari/chrome 似乎没有超过顶部:0。
我可以解决这个问题,但最好能提出一个干净的解决方案。
最佳答案
使用 top: auto
“重置”top
到它的initial value .
bottom
是一个完全独立于 top
的属性( an element can have both a top
and bottom
), 所以也许你不需要 bottom
不再。
此外,请确保您的覆盖选择器是 specific enough ,但在本例中这听起来不像是问题所在。
关于CSS(网络套件): overriding top with bottom on absolute-positioned element,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5078021/