我在我的網站上有一段背景圖片的代碼。CSS背景圖片太大
#bg {
height: 200%;
left: -50%;
position: fixed;
top: -50%;
width: 200%;
}
<div id="bg">
<img alt="" src="sites/all/themes/marques/images/sponsors.png" id="bg1">
</div>
鏈接是在這裏:
http://dev-marquesogden.pantheon.io/sponsors
我試圖使圖像(雖然非常大,以適應背景中
任何想法
這不是背景圖片。您正在將圖像插入您的#bg div。你在哪裏定義背景圖片。我沒有看到它在你的代碼或頁面源代碼 –
這裏是代碼爲bg img #bg img { position:absolute; left:0; right:0; bottom:0; margin:auto;最小寬度:50%;最小高度:50%; } – fitnessCraze
您是想嘗試背景圖片還是包含圖片的div?因爲你的標題說背景圖像,但你的代碼說它在div內的圖像? –