【问题标题】:Does Firefox not support position: relative?Firefox 不支持位置:相对吗?
【发布时间】: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 示例添加到我的帖子中

标签: css firefox


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2018-07-16
    • 2014-12-23
    • 2012-01-21
    • 2013-10-13
    • 1970-01-01
    • 2014-09-21
    • 2013-12-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多