I have Bootstrap 5 website template and I need to add text with white background on the center image.
This is my code
<div class="container-fluid overflow-hidden">
<div class="row">
<div class="col-12 col-md-6 p-0 position-relative">
<div class="position-relative">
<img class="img-fluid w-100 h-100 object-fit-cover" loading="lazy" src="images/contact-us-img.png" alt="">
<div class="contact-image-box">
<h3 class="our-company-title">Title</h3>
<p class="our-company-text">Company text</p>
</div>
</div>
</div>
<div class="col-12 col-md-6 align-self-md-center">
content here
</div>
</div>
</div>
and I try to use this css
.our-company-title{
line-height: 31px;
letter-spacing: 0;
color: #000;
font-size: 25px;
}
.our-company-text{
color: #787878;
line-height: 150%;
font-size: 18px;
letter-spacing: 0;
}
.contact-image-box {
position: absolute;
background-color: #fff;
text-align: center;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
And in this case, I see a white color instead image but I want to white rectangle with a title and text in the center of the image
also I tried
.contact-image-box {
max-width: 400px;
}
But in this case title and text align left but not center