如果有人问过,请提前抱歉:我找不到,但我对我使用的关键字不太确定。
总之!我试图在图像上放置一条不透明的白色渐变线。这是我试图解决的问题:
div.horizontal
{
position: relative;
width: 100%;
height:45px;
}
div.horizontal ul
{
list-style-type:none;
margin:0;
padding:0;
}
div.horizontal li
{
float:left;
}
div.horizontal a
{
display:block;
width:312px;
height:35px;
background-image: url("../img/truefactzheader.png");
}
div.horizontal a:link,div.horizontal a:visited
{
font-weight:bold;
color:#FFFFFF;
text-align:center;
vertical-align:middle;
padding:4px;
text-decoration:none;
text-transform:uppercase;
}
div.horizontal a:hover,div.horizontal a:active
{
height:45px;
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
}
渐变代码是这样的:
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 51%, rgba(255,255,255,0.15) 52%, rgba(255,255,255,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(51%,rgba(255,255,255,0.15)), color-stop(52%,rgba(255,255,255,0.15)), color-stop(100%,rgba(255,255,255,0)));
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#00ffffff',GradientType=0 );
如何获得一个?
编辑:
我试过了:
background: url("../img/truefactzheader.png"), -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 51%, rgba(255,255,255,0.15) 52%, rgba(255,255,255,0) 100%);
background: url("../img/truefactzheader.png"), -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(51%,rgba(255,255,255,0.15)), color-stop(52%,rgba(255,255,255,0.15)), color-stop(100%,rgba(255,255,255,0)));
background: url("../img/truefactzheader.png"), -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
background: url("../img/truefactzheader.png"), -o-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
background: url("../img/truefactzheader.png"), -ms-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
background: url("../img/truefactzheader.png"), (linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,0.15) 51%,rgba(255,255,255,0.15) 52%,rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#00ffffff',GradientType=0 );
但它仍无法正常工作
答案 0 :(得分:2)
渐变被认为是CSS 3中的图像,所以只包括渐变和放大器。 bg-image由background
简写属性中的逗号分隔,现在CSS 3允许多个背景图像。此外,因为CSS从右向左解析,您必须先指定渐变,然后然后指定图像,以使其显示在图像“上方”。