0
這是我的代碼:背景圖片不適合整個瀏覽器的寬度?
#content{
background-image: url('../images/hero.jpg');
background-size: cover;
background-repeat: no-repeat;
width:100%;
height: 550px;
}
爲什麼它不適合用100%的寬度,並與蓋屏幕?
這是我的代碼:背景圖片不適合整個瀏覽器的寬度?
#content{
background-image: url('../images/hero.jpg');
background-size: cover;
background-repeat: no-repeat;
width:100%;
height: 550px;
}
爲什麼它不適合用100%的寬度,並與蓋屏幕?
您在#content上設置了100%的寬度,而不是在背景上。試試這個:
#content {
background: url('/images/bg.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
你能提供更多的標記嗎?如果文檔中有更多內容,很難說實際上'#content'是什麼。 –
試試'body {padding:0; margin:0}' – vaso123
你能發佈一些html嗎 –