【问题标题】:Why is the wrapper div getting the top margin applied when applying to its child div?为什么包装器 div 在应用于其子 div 时会应用上边距?
【发布时间】:2011-07-27 04:15:27
【问题描述】:

这是一个示例 html:

<div id = "wrapper">
   <div id = "content">
   </div>
</div>

这里是 CSS:

#wrapper
{
  width:  1000px;
  min-height:  850px;
  border:   1px solid;
}
    #content
    {
        height:  450px;
        float:   left;
        margin:  50px 0px 0px 0px;
    }

所以当您在浏览器中查看时,包装器 div 正在应用边距?这是为什么呢?

【问题讨论】:

  • 它不适合我(chrome 10)。
  • 不,不是:jsfiddle.net/DSyRA
  • 您在哪个浏览器中看到此问题?
  • 我看到的只是 Body 默认的 8px 边距和 10px 内边距。 FF4.

标签: css layout html margin


【解决方案1】:

您是否删除了正文标签中的边距?

<body  marginheight="0" marginwidth="0">

【讨论】:

    猜你喜欢
    • 2013-06-12
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多