【问题标题】:Firefox not recognizing negative marginFirefox 无法识别负边距
【发布时间】:2014-03-20 07:02:41
【问题描述】:

请查看此页面:http://www.qhs.co.uk/high-wycombe-boiler-installation

#wrap .pushup {
  margin-top: -215px;
}

这在 Chrome 中完美运行,但在 Firefox 中却不行。显然它不能识别负边距。

Chrome(正确):

Firefox(错误):

我认为这可能是浮动 div 问题。我尝试使用 clearfix 并将 .pushup 类移动到外部 div 中,但仍然没有运气。

有什么想法吗?

我正在使用 Bootstrap 3.1。

【问题讨论】:

  • 你试过float: left吗?

标签: html css twitter-bootstrap firefox margin


【解决方案1】:

当谈到负边距时,FF 很难理解。所以不要使用负边距,而是使用相对定位。

#wrap .pushup {
  position:relative;
  top:-215px;
}

【讨论】:

  • 这段代码对你有用吗?我在浏览器中尝试过它的工作正常
  • 谢谢,它确实有效,但我选择了另一个答案,因为我们可能不应该首先设置height: 100%
【解决方案2】:

如果您删除 .jumbotron > .container > .row > .col-xs-12 { height:100%; },它应该会在 Firefox 中正确显示。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-29
    • 2011-10-11
    • 1970-01-01
    • 2011-02-01
    • 2014-02-23
    • 2012-04-02
    • 2013-08-10
    • 2012-08-06
    相关资源
    最近更新 更多