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