admin 发表于 2016-3-9 10:00:48

【CSS3】背景上下线性渐变色脚本

background:#c00;
background:-webkit-gradient(linear, left top, left bottom, from(#f00), to(#c00), color-stop(0.5, #e00));
background: linear-gradient(to bottom, #f00 0%,#c00 100%);
1-3行为完整的背景渐变,切勿丢弃任何一行,以免不同的显示器无法显示背景。
第二行支持:chrome,edge
第三行支持:IE
当不支持第一行第二行的CSS语法时,请勿必追加第一行。
示例为:线性渐变,从左上到左下 从红色到深红色,中间色为色EE0000。

admin 发表于 2017-2-8 16:36:02

在线工具:http://www.colorzilla.com/gradient-editor/

各大浏览器解决方案background: #125792; /* Old browsers */
background: -moz-linear-gradient(top, #125792 1%, #05417f 47%, #04457b 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #125792 1%,#05417f 47%,#04457b 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #125792 1%,#05417f 47%,#04457b 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#125792', endColorstr='#04457b',GradientType=0 ); /* IE6-9 */

admin 发表于 2018-4-20 19:21:38

<div style="width:800px;height:60px;line-height:60px;text-align:center;color:#fff;background: #125792; background: -moz-linear-gradient(top, #125792 1%, #05417f 47%, #04457b 100%);background: -webkit-linear-gradient(top, #125792 1%,#05417f 47%,#04457b 100%);background: linear-gradient(to bottom, #125792 1%,#05417f 47%,#04457b 100%); filter: progidXImageTransform.Microsoft.gradient( startColorstr='#125792', endColorstr='#04457b',GradientType=0);">渐变效果</div>
background: #125792;<br>
background: -moz-linear-gradient(top, #125792 1%, #05417f 47%, #04457b 100%);<br>
background: -webkit-linear-gradient(top, #125792 1%,#05417f 47%,#04457b 100%);<br>
background: linear-gradient(to bottom, #125792 1%,#05417f 47%,#04457b 100%); <br>
filter: progidXImageTransform.Microsoft.gradient( startColorstr='#125792', endColorstr='#04457b',GradientType=0);<br>
页: [1]
查看完整版本: 【CSS3】背景上下线性渐变色脚本