-1
我有一個1920x579px的背景圖像,我希望它的寬度覆蓋整個屏幕,但不是它的高度,因爲如果拉伸到底部,高度看起來會很難看。請幫幫我!我真的嘗試了一切!CSS拉伸背景圖像到全寬
我有一個1920x579px的背景圖像,我希望它的寬度覆蓋整個屏幕,但不是它的高度,因爲如果拉伸到底部,高度看起來會很難看。請幫幫我!我真的嘗試了一切!CSS拉伸背景圖像到全寬
您可以使用background-size: width height;
屬性。
body{
background-size: 100% auto;
background-repeat: no-repeat;
}
你可以在CSS
BODY {
background: url(image.jpg) no-repeat center -100px fixed;
}
的-100px
設定的圖像可以被調整,以將圖像向上或向下。
background-size:100%auto;也許? – Sgoldy
[Stretch and scale a CSS image in the background - with CSS only]可能的重複(http://stackoverflow.com/questions/1150163/stretch-and-scale-a-css-image-in-the-background-與-CSS-只) –