答案 0 :(得分:0)
您可以使用linear-gradient
,因为它描述为here。您可以执行以下操作:
.hoverable:hover {
background: -webkit-linear-gradient(white, lightgray);
background: -moz-linear-gradient(white, lightgray);
background: -o-linear-gradient(white, lightgray);
background: linear-gradient(white, lightgray);
}
您可以在this Fiddle
上查看演示答案 1 :(得分:0)
试试这个
#grad1 {
height: 200px;
background: -webkit-linear-gradient(left, rgba(255,0,0,0), rgba(255,0,0,1)); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* For Firefox 3.6 to 15 */
background: linear-gradient(rgba(255,0,0,0), rgba(245,245,245,1)); /* Standard syntax (must be last) */
}

<!DOCTYPE html>
<html>
<body>
<h3>Linear Gradient - Transparency</h3>
<div id="grad1"></div>
</body>
</html>
&#13;