css中的对角梯度

css中的对角梯度,css,Css,我看到的大多数渐变要么垂直,要么水平。是否可以使用css创建对角线渐变?我想要一个渐变,从一个角落开始变暗,在另一个角落变亮。是的。具有拾取对角线的选项,请参见方向 background: -moz-linear-gradient(-45deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right bottom, color

我看到的大多数渐变要么垂直,要么水平。是否可以使用css创建对角线渐变?我想要一个渐变,从一个角落开始变暗,在另一个角落变亮。

是的。具有拾取对角线的选项,请参见方向

background: -moz-linear-gradient(-45deg,  rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(-45deg,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(-45deg,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(-45deg,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* IE10+ */
    background: linear-gradient(135deg,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */

查看此演示

并查看
http://www.colorzilla.com/gradient-editor/
用于各种方向选项