两个图像的位置和z指数作为背景

时间:2016-05-11 19:53:48

标签: css css3

我有两个图像设置为背景图像

background-image: url("one.png"), url("two.svg") ;
    background-repeat: no-repeat, no-repeat;
    background-position: center center, center bottom;
    -webkit-background-size: cover, auto;
    -moz-background-size: cover, auto;
    -o-background-size: cover, auto;
    background-size: cover, auto;

one.png位于two.svg之上,但是我想将two.svg的位置设置为以one.png覆盖,例如

background-position: center center, center bottom top -50px;

该语句抛出无效的属性错误。

如何使用属性(顶部中心等)设置图像的位置,例如,然后使用左上角调整图像的位置,依此类推?

此外,可以在此背景图像上设置类似z-index的内容吗? 我希望two.svg成为"在"之前one.png。

1 个答案:

答案 0 :(得分:0)

我不是百分百肯定,如果我理解你想要做什么,但我会把它们放在2个不同的div中然后使用z-index并且像这样你可以将png放在{{1在position: relative;中使用svg创建div,然后执行position: absolute;top: -50px; bottom: -50px; 我希望它可以帮到你