我遇到了一个奇怪的问题,在页脚和页面底部之间存在48页的无边距/填充(我还注意到,如果从页面底部删除页脚DOM,这个空间仍然在下一个元素的下方)。无法删除页面底部的空间
我只注意到它,当我(图中黄色)施加的背景颜色到body
。我也在使用标准化样式表,并尝试在页脚上强制使用margin-bottom
无效。
基本结构:
<footer>
<section>
</section>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
</footer>
相关CSS:
* {
box-sizing: border-box;
outline: none;
}
html {
font-size: 16px;
}
body {
width: 100%;
background-color: #fefde1;
line-height: 1.5;
color: #656565;
position: relative;
}
footer {
margin-bottom: 0 !important;
padding-bottom: 60px;
width: 100%;
background-color: #fff;
font-size: 1rem;
}
请分享一个实时片段代码。 –
设置100%高度的部分和部分应该在页脚标记之外 –
您的示例代码本身不会导致您描述的行为。那么你可以发布一些实际证明问题的代码吗? –