Diagonal gradient in css

后端 未结 3 1759
抹茶落季
抹茶落季 2021-01-21 19:05

Most of the gradients I\'ve seen are either vertical or horizontal. Is it possible to have a diagonal gradient using css? I would like to have a gradient that starts out dark in

相关标签:
3条回答
  • 2021-01-21 19:21
    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://jsfiddle.net/jrc72/show

    0 讨论(0)
  • 2021-01-21 19:28

    See this demo http://jsfiddle.net/FQSdb/

    and also check out http://www.colorzilla.com/gradient-editor/ for various orientation options

    0 讨论(0)
  • 2021-01-21 19:30

    Yes. http://www.colorzilla.com/gradient-editor/ has option to pick diagonal, see orientation.

    0 讨论(0)
提交回复
热议问题