background: linear-gradient(direction, color-stop1, color-stop2, ...);
从上到下:
#grad { ?background: -webkit-linear-gradient(red, blue); /* Safari 5.1 - 6.0 */ ?background: -o-linear-gradient(red, blue); /* Opera 11.1 - 12.0 */ ?background: -moz-linear-gradient(red, blue); /* Firefox 3.6 - 15 */ ?background: linear-gradient(red, blue); /* 标准的语法 */}
从左到右:
#grad { ?background: -webkit-linear-gradient(left, red , blue); /* Safari 5.1 - 6.0 */ ?background: -o-linear-gradient(right, red, blue); /* Opera 11.1 - 12.0 */ ?background: -moz-linear-gradient(right, red, blue); /* Firefox 3.6 - 15 */ ?background: linear-gradient(to right, red , blue); /* 标准的语法 */}
CSS3 线性渐变
原文地址:https://www.cnblogs.com/xulei1992/p/10224246.html