dynamic-mask-pre-effects-bbox-ref.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. #container {
  6. border: 3px dotted black;
  7. background: yellow;
  8. overflow: hidden;
  9. width: 400px;
  10. max-height: 25px;
  11. }
  12. #container.masked {
  13. mask: url('#fade_mask_bottom');
  14. }
  15. .item {
  16. font-size: 30px;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <div id='container' class="masked"><div class="item">PASS</div></div>
  22. <!-- BEGIN SVG MASK: -->
  23. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  24. <mask id="fade_mask_bottom"
  25. maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
  26. <linearGradient id="fade_gradient_bottom"
  27. gradientUnits="objectBoundingBox" x2="0" y2="1">
  28. <stop stop-color="white" stop-opacity="1" offset="0.7"></stop>
  29. <stop stop-color="white" stop-opacity="0" offset="1"></stop>
  30. </linearGradient>
  31. <rect x="0" y="0" width="1" height="1"
  32. fill="url(#fade_gradient_bottom)"></rect>
  33. </mask>
  34. </svg>
  35. <!-- END SVG MASK -->
  36. </body>
  37. </html>