My Images are refusing to align in a horizontal row no matter what I try.
Output: https://i.sstatic.net/echGV.png
.img-size-square {
width: 100%;
height: auto;
max-width: 400px !important;
max-height: 400px !important;
}
.container-for-hover {
position: relative;
width: 50%;
}
.image-for-hover {
display: block;
width: 100%;
height: auto;
}
.overlay-for-hover {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #6633ff;
}
.container-for-hover:hover .overlay-for-hover {
opacity: 1;
}
.text-for-hover {
color: white;
font-weight: bold;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="46242929323532342736067368776875">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e7858888939493958697a7d2c9d6c9d4">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
<div class="row">
<div class="row">
<div class="d-flex col-12">
<div class="mx-auto">
<div class="container-for-hover img-size-square mb-2">
<img class="image-for-hover" src="http://jazzfu.000webhostapp.com/upload/placeholder-sq.webp">
<div class="overlay-for-hover">
<div class="text-for-hover">Some Content Here 1, Row 1</div>
</div>
</div>
<div class="container-for-hover img-size-square mb-2">
<img class="image-for-hover" src="http://jazzfu.000webhostapp.com/upload/placeholder-sq.webp">
<div class="overlay-for-hover">
<div class="text-for-hover">Some Content Here 2, Row 1</div>
</div>
</div>
<div class="container-for-hover img-size-square mb-2">
<img class="image-for-hover" src="http://jazzfu.000webhostapp.com/upload/placeholder-sq.webp">
<div class="overlay-for-hover">
<div class="text-for-hover">Some Content Here 3, Row 1</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="d-flex col-12">
<div class="mx-auto">
<div class="container-for-hover img-size-square mb-2">
<img class="image-for-hover" src="http://jazzfu.000webhostapp.com/upload/placeholder-sq.webp">
<div class="overlay-for-hover">
<div class="text-for-hover">Some Content Here 1, Row 2</div>
</div>
</div>
<div class="container-for-hover img-size-square mb-2">
<img class="image-for-hover" src="http://jazzfu.000webhostapp.com/upload/placeholder-sq.webp">
<div class="overlay-for-hover">
<div class="text-for-hover">Some Content Here 2, Row 2</div>
</div>
</div>
<div class="container-for-hover img-size-square mb-2">
<img class="image-for-hover" src="http://jazzfu.000webhostapp.com/upload/placeholder-sq.webp">
<div class="overlay-for-hover">
<div class="text-for-hover">Some Content Here 3, Row 2</div>
</div>
</div>
</div>
</div>
</div>
</div>
What I've Attempted:
I've gone through the official documentation and also tried solutions from here -> W3 BS5 Docs. I experimented with the use of flex-row
, but I'm still relatively new to the field of web development.
Objective:
The container-for-image
Div(s) should align in a horizontal row within each row
class div