background-image 中的第一个 linear-gradient 是设置 li 标签的背景色的,
第二个 linear-gradient 配合 border-image 即可设置 border 的渐变色。
<!DOCTYPE html><html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.demo{
width:200px
height:10px
background:-webkit-linear-gradient(left, rgb(80,80,255,0.2) , #fff) /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(left, rgb(80,80,255,0.2) , #fff)/* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(left, rgb(80,80,255,0.2) , #fff)/* Firefox 3.6 - 15 */
background: linear-gradient(to left, rgb(80,80,255,0.2) , #fff)/* 标准的语法 */
}
</style>
</head>
<body>
<div class="demo" ></div>
</body>
</html>
CSS3 定义了两种类型的渐变(gradients):
线性渐变(Linear Gradients)- 向下/向上/向左/向右/对角方向
语法:background-image: linear-gradient(direction, color-stop1, color-stop2, ...)
径向渐变(Radial Gradients)- 由它们的中心定义
语法:background-image: linear-gradient(angle, color-stop1, color-stop2)