编辑下面的代码:【加编码】
<html> <head> <style> #grad1 { height: 200px; background: -webkit-linear-gradient(left top, red , blue); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(bottom right, red, blue); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(bottom right, red, blue); /* Firefox 3.6 - 15 */ background: linear-gradient(to bottom right, red , blue); /* 标准的语法(必须放在最后) */ } </style> </head> <body> <h3>线性渐变 - 对角</h3> <p>从左上角开始(到右下角)的线性渐变。起点是红色,慢慢过渡到蓝色:</p> <div id="grad1"></div> <p><strong>注意:</strong> Internet Explorer 9 及之前的版本不支持渐变。</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂