【问题标题】:Negative margin-top behaves differently on Chrome and Firefox负边距顶部在 Chrome 和 Firefox 上的行为不同
【发布时间】:2014-04-16 12:28:45
【问题描述】:

我试图通过使用负边距顶部将两个嵌套的 div 对齐到一行中,但是 Firefox (FF) 和 Chrome 上的呈现完全不同。以下是http://jsfiddle.net/2SK5t/上的dummpy示例

HTML

<div class='row_custom'>
    <div>Hello World</div>
</div>
<div class='row_custom'>
    <div class='row_2'>Hello World</div>
</div>

CSS

.row_custom{
    margin-right: 0px;
    margin-left: 0px;
    display: table;
    content: " ";
}
.row_2{
    color:blue;
    margin-top: -20px;
}

【问题讨论】:

    标签: html css google-chrome firefox


    【解决方案1】:

    删除display: table;,它们匹配。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-09
      • 1970-01-01
      • 2018-07-13
      • 1970-01-01
      • 2018-07-20
      • 2013-01-05
      • 1970-01-01
      • 2016-09-05
      相关资源
      最近更新 更多