0

我从 css graident generator 得到这段代码,它在渐变的底部是透明的

background: -moz-linear-gradient(top,  rgba(248,246,247,1) 0%, rgba(248,246,247,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(248,246,247,1)), color-stop(100%,rgba(248,246,247,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(248,246,247,1) 0%,rgba(248,246,247,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(248,246,247,1) 0%,rgba(248,246,247,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(248,246,247,1) 0%,rgba(248,246,247,0) 100%); /* IE10+ */
background: linear-gradient(to bottom,  rgba(248,246,247,1) 0%,rgba(248,246,247,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f6f7', endColorstr='#00f8f6f7',GradientType=0 ); /* IE6-9 */

现在我想在渐变背景上添加一个背景

background: url('../images/letter_head.png') left top repeat-x, #f8f6f6;

我如何将它们结合起来?

4

2 回答 2

0

CSS

.bg{
    width:800px; height:750px;
    background: #38BAC9 url(http://www.google.com/logos/2012/india12-hp.jpg) 10% no-repeat;
    background:url(http://www.google.com/logos/2012/india12-hp.jpg) center no-repeat, -webkit-gradient(linear, 0% 0%, 0% 100%, from(#57BEED), to(#38BAC9));
    background:url(http://www.google.com/logos/2012/india12-hp.jpg) center no-repeat, -moz-linear-gradient(top, #57BEED 0%, #38BAC9 100%);    
}​

演示

检查此链接以获取更多信息

http://userinterfacehome.blogspot.in/2012/09/css-multiple-background.html

于 2012-11-29T08:05:38.680 回答
0

只需将图像的网址添加到您的每个规则中即可。

background: url(someurl), -moz-linear-gradient(top,  rgba(248,246,247,1) 0%, rgba(248,246,247,0) 100%); /* FF3.6+ */

或者,如果您不想添加url(etc)每个规则,您可以只指定一个background-image规则:

background: -moz-linear-gradient(top,  rgba(248,246,247,1) 0%, rgba(248,246,247,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(248,246,247,1)), color-stop(100%,rgba(248,246,247,0))); /* Chrome,Safari4+ */
...
background-image:url("someurl");
于 2012-11-29T08:06:08.027 回答