Explanation of Solution
In order to create this design, you will need a parent DIV element containing an image and text. The text (inside an <h2>
tag) will be positioned absolutely with a z-index of -1 to layer it beneath the image. The parent div will also need to have a relative position in order for the absolute positioning of the <h2>
to work correctly.
The use of CSS properties like
top: 15%; right: 50%; transform: translate(50%, -50%);
ensures that the absolute
<h2>
is centered horizontally and can be adjusted vertically as needed based on the image dimensions.
Additionally, styling elements such as letter-spacing
are applied to achieve a specific visual aesthetic similar to the provided image.
* {
margin: 0;
padding: 0;
}
.banner {
position: relative;
height: 500px;
text-align: center;
}
.banner h2 {
position: absolute;
top: 15%;
right: 50%;
transform: translate(50%, -50%);
font-size: 10rem;
letter-spacing: 20px;
z-index: -1;
}
.banner img {
height: 100%;
}
<div class="banner">
<h2>LUVBAG</h2>
<img src="https://www.pngall.com/wp-content/uploads/2016/04/Women-Bag-Transparent.png" alt="">
</div>