webkit-gradient-linear-2-ref.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE html>
  2. <!--
  3. Any copyright is dedicated to the Public Domain.
  4. http://creativecommons.org/publicdomain/zero/1.0/
  5. -->
  6. <html>
  7. <head>
  8. <title>CSS Reference</title>
  9. <style>
  10. div {
  11. border: 1px solid black;
  12. width: 30px;
  13. height: 50px;
  14. margin: 1px;
  15. float: left;
  16. }
  17. br { clear: both; }
  18. </style>
  19. </head>
  20. <body>
  21. <!-- No color stops (transparent): -->
  22. <div></div>
  23. <!-- Add another background to be sure we're transparent, not white: -->
  24. <div style="background: linear-gradient(to right, pink, purple)"></div>
  25. <br>
  26. <!-- One color stop, at various positions (renders as solid color): -->
  27. <div style="background: blue"></div>
  28. <div style="background: blue"></div>
  29. <div style="background: blue"></div>
  30. <div style="background: blue"></div>
  31. <br>
  32. <!-- Two color stops, both at the same position: -->
  33. <div style="background: yellow"></div>
  34. <div style="background: blue"></div>
  35. <div style="background: linear-gradient(to right,
  36. blue 30%, yellow 30%)"></div>
  37. <div style="background: yellow"></div>
  38. <div style="background: blue"></div>
  39. <br>
  40. <!-- Color stops out of order & need (stable) sorting: -->
  41. <div style="background: linear-gradient(to right,
  42. blue, yellow)"></div>
  43. <div style="background: linear-gradient(to right,
  44. salmon, yellow)"></div>
  45. <div style="background: linear-gradient(to right,
  46. blue, yellow)"></div>
  47. <div style="background: linear-gradient(to right,
  48. blue, yellow)"></div>
  49. <div style="background: linear-gradient(to right,
  50. yellow, salmon 80%, blue)"></div>
  51. </body>
  52. </html>