<figure class="container">
<img src="https://assets.codepen.io/5928893/masking-balloons.jpg" alt="balloons">
<figcaption>Balloons</figcaption>
</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;
position: relative;
border:1px solid #ccc;
}
.container img {
width: 100%;
height: 100%;
object-fit: cover;
-webkit-mask-image: linear-gradient(to top, transparent 5%, black 100%);
mask-image: linear-gradient(to top, transparent 5%, black 100%);*/
}
.container figcaption {
position: absolute;
bottom: 1em;
right: 1em;
font-size: 150%;
color: #333;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.