[英]Image is not taking full screen with CSS
我有一張想要占據整個屏幕的圖像,但是在屏幕的頂部和左側留有一些空白,我不知道為什么要這樣做。 我附上了它的代碼。
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">
您需要重置身體上的邊緣。
/* margin reset */ body { margin: 0px; } 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">
嘗試
html,body{
padding:0;
margin:0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.