【发布时间】:2013-04-02 22:36:03
【问题描述】:
我需要通过 CSS 为一个元素附加多个背景,但我无法使用 :before/:after。
我想知道使用多个 CSS 背景图像的正确语法是什么。
我找到了很多建议的方法,例如 here 或 here,但我都无法获得:
background: url(…) 0 0 repeat, url(…) 5px 5px no-repeat #FFF;
background: url(…) 600px 10px no-repeat, url(…) 10px 10px no-repeat;
上班。
这是我目前拥有的:
background-image: rgba(0, 0, 0, 0.4) url("img/icons-18-white.png") no-repeat 0% 50%,linear-gradient( #9ad945, #7eb238 );
被忽略。只有当我提供纯 url 时,它才有效:
background-image: url("img/icons-18-white.png") , linear-gradient( #9ad945, #7eb238 );
问题:
我正在专门寻找一种方法来为每张图片设置background-size/position/repeat,所以如果有人能指出我正确的语法,那就太好了!
编辑:
添加scroll并将background-image替换为background
background: rgba(0, 0, 0, 0.4) url("http://code.jquery.com/mobile/1.3.0/images/icons-18-white.png") no-repeat scroll 0% 50%, linear-gradient( #9ad945, #7eb238 );
不工作。
【问题讨论】:
-
我认为这是不可能的。你为什么要这样做?
-
应该可以,但我无法让它工作。查看我的最新编辑。
标签: css background background-image