【问题标题】:I have html,body and container div set to 100% height yet there is still a gap at top of page?我已将 html、body 和容器 div 设置为 100% 高度,但页面顶部仍有间隙?
【发布时间】:2012-08-03 16:11:25
【问题描述】:
@charset "utf-8";

html {
height:100%;

}

body {
background-color:#000000;
height:100%;
}

img
{  border-style: none;
}

container {
background: #EEE;
position:relative;
width:763px;
margin:auto;
min-height:100%;
border-right: 2px solid #0F0;
border-left: 2px solid #0F0; position:inherit;}

伙计们,怎么了? 是不是因为我读到的 utf-8 会留下没有宽度的垂直间隙,idk 有点在黑暗中拍摄。

【问题讨论】:

    标签: html height gaps-in-visuals


    【解决方案1】:

    您已将内容高度设置为 100%,但未删除默认边距(或某些浏览器中的填充)。这意味着内容是视口的高度,并且您会获得滚动条,以便您可以到达它的底部。

    设置:

    html, 
    body { 
        margin: 0;
        padding: 0;
    }
    

    删除默认边距/填充。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-09
      • 2018-09-07
      • 2020-08-09
      • 1970-01-01
      • 2012-01-18
      • 1970-01-01
      • 2021-07-13
      相关资源
      最近更新 更多