CSS(webkit):在绝对定位的元素上覆盖顶部和底部

问题描述:

我在覆盖一些插件CSS时遇到问题.直接编辑CSS并不是真正的选择,因为这样做会使更新插件的风险更大.

I'm having a problem with overriding some plugin CSS. Editing that CSS directly is not really an option, as it would make updating the plugin more risky.

问题:元素具有绝对定位,并且在原始元素中具有top:0px.我想用bottom:0px覆盖它.

The problem: an element has absolute positioning, and has top:0px in the original. I want to override it by bottom:0px.

为了示例

    .element {position:absolute; top:0;}

    /* in another file */
    .my .element {bottom:0;}

在Firefox上可以正常使用(底部为0:应用的样式),但Safari/chrome似乎并没有超越顶部:0.

On firefox this works ok (bottom:0 is the applied style), but safari/chrome don't seem to be get over the top:0.

我可以解决此问题,但是想出一个干净的解决方案会很好.

I can work around this problem, but it would be nice to come up with a clean solution.

使用top: autotop重置为 bottomtop的完全独立属性(元素可以同时具有top),所以也许您将不再需要bottom.

bottom is a totally separate property to top (an element can have both a top and bottom), so perhaps you won't need bottom anymore.

还要确保您的替代选择器足够具体,但是听起来不是这种情况下的问题.

Also, make sure your override selector is specific enough, but it doesn't sound like that's the problem in this case.