8_渐变色.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. .box{
  9. width: 500px;
  10. height: 500px;
  11. border: 1px solid black;
  12. /* background-image 背景渐变色 */
  13. /* linear-gradient 线性渐变 */
  14. /* background-image: linear-gradient(red,blue); */
  15. /* 第一个参数可以控制渐变色的方向 to right 从左向右。to left 从右向左 */
  16. /* background-image: linear-gradient(to right,red,blue); */
  17. /* to left bottom 从右上到左下 */
  18. /* background-image: linear-gradient(to left bottom,red,blue); */
  19. /* 多个颜色值 */
  20. /* background-image: linear-gradient(red,blue,yellow); */
  21. /* 角度值 */
  22. /* background-image: linear-gradient(15deg,red,blue); */
  23. /* 径向渐变 */
  24. /* background-image: radial-gradient(red,blue); */
  25. background-image: linear-gradient(rgba(77,77,77,0),black);
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <div class="box"></div>
  31. </body>
  32. </html>