我有一个我想要的图像占据整个屏幕,但在屏幕的顶部和左侧留下一些空白区域,我不知道为什么要这样做。我附上了它的代码。
img {
background: 0px 0px / 100% 100% no-repeat scroll rgb(12, 12, 12);
height: 100%;
width: 100%;
position: fixed;
}
<img src="http://www.morefree.net/wp-content/uploads/2013/03/black-wallpaper-01.jpg">
答案 0 :(得分:4)
答案 1 :(得分:3)
您需要重置身体上的边距。
/* margin reset */
body {
margin: 0px;
}
img {
background: 0px 0px / 100% 100% no-repeat scroll rgb(12, 12, 12);
height: 100%;
width: 100%;
position: fixed;
}
&#13;
<img src="http://www.morefree.net/wp-content/uploads/2013/03/black-wallpaper-01.jpg">
&#13;
答案 2 :(得分:1)
尝试
html,body{
padding:0;
margin:0;
}