我在我的網站上工作,我已經添加了一些圖像,現在我想設置一個背景,主要,其他人將會覆蓋它,這可能嗎?CSS:如何設置適合屏幕的背景圖片?
輸入background-image:url("myphoto.jpg")
不適用於我。有任何想法嗎?謝謝!
我在我的網站上工作,我已經添加了一些圖像,現在我想設置一個背景,主要,其他人將會覆蓋它,這可能嗎?CSS:如何設置適合屏幕的背景圖片?
輸入background-image:url("myphoto.jpg")
不適用於我。有任何想法嗎?謝謝!
body {
background: url("myphoto.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
將背景課程授予您想要應用背景圖像的潛水。並給CSS按如下: 這是你如何能做到:
<div class="background"></div>
and style css would be:
.background{
background: url("myphoto.jpg") no-repeat center center;
background-repeat: no-repeat;
background-size: 100% 100%;
}
@Hiren是正確的,但你需要「找到」所需的圖像,FX。如果我們說,我有我的WWW文件夾至極是我的主文件夾,我有一個index.html,並呼籲IMG的子文件夾,裏邊有我有myphoto.jpg
則應設置爲網址如下: url("img/myphoto.jpg")
body {
background: url("https://www.qdtricks.net/wp-content/uploads/2016/05/hd-road-wallpaper.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
您可以發佈您的代碼? – Nimish
你能爲我們提供一些代碼嗎? – Gabbax0r
[在後臺拉伸和縮放CSS圖像 - 僅限CSS]可能的副本(http://stackoverflow.com/questions/1150163/stretch-and-scale-a-css-image-in-the-background-與-css-only) –