【发布时间】:2012-01-31 13:09:47
【问题描述】:
我有一个 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”...当我删除 box 属性时,firefox 工作正常...
有人知道吗?
【问题讨论】:
-
你能展示一个 JSFiddle 的例子吗?在 FF 中是什么样子的?
-
Firefox 肯定支持
position:relative,让我们看看你正在尝试做什么以及实际发生了什么的最小代码示例。 -
我可以向你保证
position: relative在 Firefox 中完美运行。按照 Pekka 的建议,提供更多代码和屏幕截图或实时示例。 -
我已将 JSFiddle 示例添加到我的帖子中