{"id":305793,"date":"2020-03-29T06:31:53","date_gmt":"2020-03-29T13:31:53","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=305793"},"modified":"2021-05-10T10:57:16","modified_gmt":"2021-05-10T17:57:16","slug":"mask-image","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/m\/mask-image\/","title":{"rendered":"mask-image"},"content":{"rendered":"\n

A mask<\/code> in CSS hides part of the element is applied to. <\/p>\n\n\n\n

.element {\n  mask-image: url(star.svg);\n}<\/code><\/pre>\n\n\n\n

Say you had an element with a photographic background, and a black-and-white SVG graphic to use as a mask, like this:<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

You could set the image as a background-image<\/code> and the mask as a mask-image<\/code> on the same element, and get something like this:<\/p>\n\n\n\n