如何在后台主体中添加多个图像
问题描述:
所以我想创建一个网站,我可以让背景有一个标题图像600px
图像,即“site background
”,然后剩下的就是平铺的图像,就像以及我希望标题背景适应运动,如background-position: center;
CSS属性。如何在后台主体中添加多个图像
我看着W3
,但他们的文档很混乱。 here
这是一些代码,我想:
background: url(bg.png) top, url(tile.png) repeat;
但我不知道我怎么会是能够添加background-position & height
成说。
答
短的例子:
.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>
好老谷歌:CSS背景多张图片
结果:http://stackoverflow.com/questions/423172/can-i-have-multiple -background-images-using-css – emvidi
这不是W3网页...对于mayus抱歉,但这是很大的xd – DaniP
https://www.w3.org/ – DaniP