I don’t think you can achieve this with clip-path
but you can certainly cut a hole in a div
using the radial-gradient
background images. This has much better browser support than clip-path
too.
Note: This approach (and box-shadow
) will work only when the element that is covering the content below has a colored fill. If instead of sandybrown
color, there needs to be another image on top then these approaches will not work because they don’t actually cut a hole, they just mimic that effect.
.div-with-hole {
height: 100vh;
background: radial-gradient(circle at center, transparent 25%, sandybrown 25.5%);
background-size: 100% 100%;
background-position: 50% 50%;
transition: all 2s ease;
}
.div-with-hole:hover {
background-size: 400% 400%; /* should be 100% * (100 / transparent % of radial gradient */
}
body {
background: url(http://lorempixel.com/800/800/nature/1);
min-height: 100vh;
margin: 0;
padding: 0;
}
<div class="div-with-hole"></div>