<figure class="container">
<img src="https://assets.codepen.io/5928893/masking-balloons.jpg" alt="balloons">
</figure>
body {
font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;
margin: 2em;
}
img {
max-width: 100%;
display: block;
}
.container {
max-width: 400px;
hight: 300px;
margin: 1em auto;
border: 1px solid #ccc;
}
.container img {
width: 100%;
height: 100%;
object-fit: cover;
-webkit-mask-image: linear-gradient(
45deg,
#000000 25%,
rgba(0, 0, 0, 0.2) 25%
),
linear-gradient(-45deg, #000000 25%, rgba(0, 0, 0, 0.2) 25%),
linear-gradient(45deg, rgba(0, 0, 0, 0.2) 75%, #000000 75%),
linear-gradient(-45deg, rgba(0, 0, 0, 0.2) 75%, #000000 75%);
-webkit-mask-size: 20px 20px;
-webkit-mask-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.