【发布时间】:2016-03-25 06:28:41
【问题描述】:
http://codepen.io/basickarl/pen/Wrwdam?editors=110
html:
<div class="back">
</div>
css:
html,
body {
height: 100%;
}
div.back {
margin-top: 50px;
display: absolute;
width: 30px;
height: 30px;
background-image: url('http://simpleicon.com/wp-content/uploads/arrow-35.png');
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
右侧的滚动条显示。由于我正在使用粘性页脚,我必须拥有 100% 的 html 正文。有什么想法吗?
【问题讨论】:
-
使用
body { overflow:hidden; } -
html, 身体 { 高度: 100%;溢出:隐藏; }
-
因为你加了
margin-top: 50px,试试padding-top: 50px -
将
margin:0;padding:0添加到 html 和 body 样式中。此外,CSS 中有一个错误display:absoluteis not a valid property/value (可能是display:block或position:absolute但不是display:absolute) -
@TamilSelvanC 当内容足够长以至于实际需要滚动条时会发生什么?