簡體   English   中英

我似乎無法讓我的圖片絕對顯示在頁面頂部並覆蓋整個頁面

[英]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;
}

imgdispaly: block ,否則它不會聽widthheight: 100%

更新:

img.background {
   position: fixed;
   display: block;
   width: 100%;
   height: 100%;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM