
code:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>菜鸟教程(runoob.com)</title>
- <style>
- #grad1 {
- height: 55px;
- background-color: red; /* 浏览器不支持的时候显示 */
- background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); /* 标准的语法(必须放在最后) */
- }
- </style>
- </head>
- <body>
-
- <div id="grad1" style="text-align:center;margin:auto;color:#888888;font-size:40px;font-weight:bold">
- 渐变背景
- </div>
-
- <p><strong>注意:</strong> Internet Explorer 8 及之前的版本不支持渐变。</p>
-
- </body>
- </html>
评价