Using masks to cut a hole in the middle of an image
suggest changeCSS
div {
width: 200px;
height: 200px;
background: url(http://lorempixel.com/200/200/abstract/6);
mask-image: radial-gradient(circle farthest-side at center, transparent 49%, white 50%); /* check remarks before using */
}
HTML
In the above example, a transparent circle is created at the center using radial-gradient
and this is then used as a mask to produce the effect of a circle being cut out from the center of an image.
Image without mask:
Image with mask:
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents