Home
CSS
CSS Masking
Tryit: Use the SVG mask element to create a mask layer
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> </head> <body> <h1>The mask-image Property</h1> <h3>An SVG mask layer (formed as a star):</h3> <svg width="600" height="400"> <mask id="svgmask2"> <polygon fill="#ffffff" points="100,10 40,198 190,78 10,78 160,198"></polygon> </mask> <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="img_5terre.jpg" mask="url(#svgmask2)"></image> </svg> <h3>Original image:</h3> <img src="img_5terre.jpg" alt="Cinque Terre" width="600" height="400"> </body> </html>