如何找到透明背景颜色的正确颜色组合?

时间:2013-06-10 13:22:33

标签: css image css3 colors background-color

见图:

enter image description here

灰色区域实际上是一个图像。

如何使用css3找到最接近的颜色来创建相似的颜色?

我发现以下颜色最接近,但不确定它们是否匹配,因为我不知道如何在CSS3中使用它们:

5A5757 - 顶部

585555 - 底部

1 个答案:

答案 0 :(得分:3)

将此代码放入您的css并设置身高。

background: #5a5757; /* Old browsers */
background: -moz-linear-gradient(top, #5a5757 0%, #5a5757 15%, #2b4244 15%, #2b4244 31%, #585555 31%, #585555 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#5a5757), color-stop(15%,#5a5757), color-stop(15%,#2b4244), color-stop(31%,#2b4244), color-stop(31%,#585555), color-stop(100%,#585555)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #5a5757 0%,#5a5757 15%,#2b4244 15%,#2b4244 31%,#585555 31%,#585555 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #5a5757 0%,#5a5757 15%,#2b4244 15%,#2b4244 31%,#585555 31%,#585555 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #5a5757 0%,#5a5757 15%,#2b4244 15%,#2b4244 31%,#585555 31%,#585555 100%); /* IE10+ */
background: linear-gradient(to bottom, #5a5757 0%,#5a5757 15%,#2b4244 15%,#2b4244 31%,#585555 31%,#585555 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5a5757', endColorstr='#585555',GradientType=0 ); /* IE6-9 */