【发布时间】:2012-05-03 09:55:15
【问题描述】:
我的页面中有<div> 的样式,如下所示;
.maintab1{
background:rgb(0,65,135);
background:-moz-linear-gradient(-45deg, rgba(0,65,135,1) 0%, rgba(30,127,201,1) 29%, rgba(53,154,255,1) 62%);
background:-webkit-gradient(linear, left top, right bottom, color-stop(0%,rgba(0,65,135,1)), color-stop(29%,rgba(30,127,201,1)), color-stop(62%,rgba(53,154,255,1)));
background:-webkit-linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
background:-o-linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
background:-ms-linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
background:linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#004187', endColorstr='#359aff',GradientType=1 );
}
我想包含一个图像 image.png 作为背景图像以及 CSS3 渐变。
我检查了this * question 和this article 并最终得到以下代码;
background-image:url(image.png), -moz-linear-gradient(-45deg, rgba(0,65,135,1) 0%, rgba(30,127,201,1) 29%, rgba(53,154,255,1) 62%);
并应用了所有其他属性并且工作正常。
但这在 IE8 中不起作用(仅在 IE8 和 FF3+ 中测试过)并且相信不会在旧版本中起作用。渐变效果很好,但图像没有出现。
有人能告诉我用 CSS3 渐变显示背景图像的方式不是我已经提到的方式吗?
【问题讨论】:
-
你检查过这个吗? *.com/questions/2504071/…
-
这可能会解决您的问题:heresonesolution.com/2010/09/…
标签: css background-image