最佳答案
这是因为你给body,html赋予了高度。
尝试删除它,它将解决您的问题。
这是更新后的 fiddle :
html {
}
body {
background:#fff;
margin-top:20px;
}
此外,如果您希望容器获得特定的最小高度或设备高度,请尝试使用 js 进行分配。您的设备高度是 $(window).height()。您可以使用它做其他子/添加并通过 $('#containerid').height(calculatedHeight); 设置容器高度;
关于html - 页面即使没有内容也有滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24114115/