定位多个背景图像

时间:2017-06-30 11:29:02

标签: html css background-image

这是我的代码。我想将那个黄色圆圈向右移动(大约25px)。我可以将这种风格仅用于第二张图像。



.img_home
{
    background-repeat: no-repeat;
    height: 1000px;
    background-image: url(http://www.spidycode.com/testing/revibe/images/Circle1.png),url(http://www.spidycode.com/testing/revibe/images/Circle2.png);
}

<div class="img_home"></div>
&#13;
&#13;
&#13;

4 个答案:

答案 0 :(得分:2)

只需添加background-position: 25px 0px, 0px 0px;

即可

答案 1 :(得分:2)

试试这个

&#13;
&#13;
.img_home
{
    background-repeat: no-repeat;
    height: 1000px;
    background: url(http://www.spidycode.com/testing/revibe/images/Circle1.png) 25px top no-repeat,url(http://www.spidycode.com/testing/revibe/images/Circle2.png) no-repeat;
}
&#13;
<div class="img_home"></div>
&#13;
&#13;
&#13;

答案 2 :(得分:1)

试试这个

.img_home
{
    background-repeat: no-repeat;
    height: 1000px;
    background: url(http://www.spidycode.com/testing/revibe/images/Circle1.png) 25px 0 no-repeat,url(http://www.spidycode.com/testing/revibe/images/Circle2.png) no-repeat;
}
<div class="img_home">

答案 3 :(得分:1)

您可以使用background设置参数:

background: url repeat posX posY

.img_home
{
    height: 1000px;
    background: url(http://www.spidycode.com/testing/revibe/images/Circle1.png) no-repeat,url(http://www.spidycode.com/testing/revibe/images/Circle2.png) no-repeat 200px 0px;
}
<div class="img_home"></div>