Does Firefox not support position: relative?



我有一个div,下面是它的css

#sign_up_box_1 {
    width: 400px;
    height: 280px;
    position:relative;
    top: -290px;
}

它在safari中运行良好,但在Firefox中不起作用。

Firefox似乎忽略了顶部:-290px。

有人能帮我吗?

以下是JSFiddle代码:

HTML

<div id="container">
    <div id="test"></div>
</div>

CSS

#container {
    -moz-box-align: center;
    -moz-box-orient: vertical;
    -moz-box-pack: center;
    display: -moz-box;
    position: relative;
    width: 200px;
    z-index: 0;
}
#test {
    width: 100px;
    height: 100px;
    background-color: red;
    position: relative;
    top: -50px;
}

它在safari和chrome中运行良好。。但在firefox 中失败

我发现问题出在"盒子"。。。当我删除box属性时,firefox运行良好。。。

有人知道吗?

Gecko中不支持XUL框的子对象的相对定位。在XUL盒子模型中做这种事情真的没有任何意义。

当然,只要你坚持使用标准的CSS,相对定位就会如预期的那样工作。

最新更新