【发布时间】:2016-09-28 05:03:51
【问题描述】:
我正在尝试为我的页面添加背景颜色,但它没有正确覆盖整个页面。
截图1:从这里可以看出,卡片后面有空白:
CSS 代码
#background
{
background-color:#9B59B6;
margin: -19px 0 0 0; /*-19px here to remove white space on the very top of the page*/
width: 100%;
}
如果我添加:
position:absolute;
height:100%;
width:100%;
它可以解决问题,但是,它会导致另一个这样的问题:
截图2:这里,当我添加更多卡片时,向下滚动,背景下方有一个空白:
截图2的CSS代码
#background
{
position:absolute;
height:100%;
width:100%;
background-color:#9B59B6;
margin: -19px 0 0 0;
width: 100%;
}
我该如何解决这个问题?我尝试使用position:relative 或overflow:hidden,但没有帮助。
我在 ASP.net MVC 6 上做这个,所以格式是 cshtml 而不是 html。
请帮忙,谢谢!
【问题讨论】:
标签: html css twitter-bootstrap background-color