[英]I can't seem to get my image to be absolute to the top of my page and cover the whole page
我的網站有背景圖片,它確實覆蓋了整個頁面,但問題是該圖片從頂部和底部而不是底部移出。
這是我的HTML:
<img class="background" url="../images/splash.png" />
<div class="wrapper">
test
</div>
這是我的CSS:
img.background{
position:fixed;
top:0;
width:100%;
height:100%;
z-index:0
}
div.wrapper{
margin-top:0;
position:relative;
z-index:1;
}
給img
: dispaly: block
,否則它不會聽width
和height: 100%
。
更新:
img.background {
position: fixed;
display: block;
width: 100%;
height: 100%;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.