2016-11-25 23 views
0

所以我想創建一個網站,我可以讓背景有一個標題圖像600px圖像,即「site background」,然後剩下的就是平鋪的圖像,就像以及我希望標題背景適應運動,如background-position: center; CSS屬性。如何在後臺主體中添加多個圖像

我看着W3,但他們的文檔很混亂。 here

這是一些代碼,我想:

background: url(bg.png) top, url(tile.png) repeat; 

但我不知道我怎麼會是能夠添加background-position & height成說。

+0

好老谷歌:CSS背景多張圖片
結果:http://stackoverflow.com/questions/423172/can-i-have-multiple -background-images-using-css – emvidi

+0

這不是W3網頁...對於mayus抱歉,但這是很大的xd – DaniP

+0

https://www.w3.org/ – DaniP

回答

1

短的例子:

.web { 
 
    width: 800px; 
 
    height: 1000px; 
 
    background-image: url(https://dummyimage.com/800x600/000/fff), url(https://dummyimage.com/800x300/555/fff); 
 
    background-size: 300px 200px, 300px 100px; 
 
    background-repeat: no-repeat, no-repeat; 
 
    background-position: center 0px, center 200px; 
 
}
<div class="web"></div>

相關問題