mask-clip-2.html (1537B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Masking: mask-clip: clip mask image</title> 6 <link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com"> 7 <link rel="author" title="Mozilla" href="https://www.mozilla.org"> 8 <link rel="help" href="http://www.w3.org/TR/css-masking-1/#the-mask-clip"> 9 <link rel="match" href="mask-clip-2-ref.html"> 10 <meta name="assert" content="fill-box, stroke-box and view-box values of mask-clip should clip to the appropriate boxes."> 11 <style type="text/css"> 12 svg { 13 position: absolute; 14 top: 10px; 15 border: 1px solid black; 16 } 17 18 rect.mask { 19 fill: blue; 20 mask-origin: fill-box; 21 mask-repeat: no-repeat; 22 mask-image: url(support/50x50-opaque-blue.svg); 23 } 24 25 rect.view { 26 mask-clip: view-box; 27 } 28 29 rect.fill { 30 mask-clip: fill-box; 31 } 32 33 rect.stroke { 34 mask-clip: stroke-box; 35 } 36 </style> 37 </head> 38 <body> 39 <svg width="200" height="200" viewBox="0 0 100 100" preserveAspectRatio="none" style="left: 10px;"> 40 <rect class="view mask" x="10" y="10" width="50" height="100"/> 41 </svg> 42 <svg width="200" height="200" style="left: 220px;"> 43 <rect class="fill mask" x="50" y="50" width="150" height="150"/> 44 </svg> 45 <svg width="200" height="200" style="left: 10px; top: 220px;"> 46 <rect class="stroke mask" x="50" y="50" width="100" height="100" stroke="green" stroke-width="20"/> 47 </svg> 48 </body> 49 </html>