<div></div>
<div></div>
<div></div>
<div></div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
display: grid;
grid-template-columns: repeat(4, 400px);
gap: 10px;
padding: 10px;
place-items: center;
}
div {
width: 400px;
height: 688px;
&:nth-child(1) {
background: url('//www.w3cplus.com/sites/default/files/blogs/2019/1905/mask-clip-path-1.png') no-repeat;
background-size: 400px 688px;
position: relative;
}
&:nth-child(2) {
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/mask.png') no-repeat center;
}
&:nth-child(3) {
background: linear-gradient(to bottom, #000, #000);
}
&:nth-child(4){
background: url('//www.w3cplus.com/sites/default/files/blogs/2019/1905/mask-clip-path-1.png') no-repeat;
background-size: 400px 688px;
position: relative;
&::after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0,0,0,.65);
mask-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/mask.png'), linear-gradient(to bottom, #000, #000);
mask-repeat:no-repeat, repeat;
mask-position: 338px 274px, 0 0;
mask-size: 64px 64px;
mask-composite: exclude;
mask-composite: xor;
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.