I would like to make these thumbnails smaller and a bit more close together in the middle of the page, I managed to do that but even though the thumbnails remain responsive, the title container is not, and stays the same size when i shrink and enlarge the page.The code as it is right now works perfectly but all goes downhill when i want to make the thumbnails smaller and more close together.
Can anyone help me make the text be responsive aswell?
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
gap: 10px;
background: rgb(255, 255, 255);
padding: 20px;
}
.box>img {
width: 100%;
display: block;
background-color: cornflowerblue;
border-top-right-radius: 1rem;
border-top-left-radius: 1rem;
}
.box:hover {
transform: scale(1.04);
}
.box .title {
background: #ddd;
padding: 0.5rem 1rem;
text-align: center;
width: -webkit-fill-available;
border-bottom-left-radius: 0.5rem;
border-bottom-right-radius: 0.5rem;
}
<!DOCTYPE html>
<html>
<body>
<div class="container">
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
<div class="box">
<img src="https://sppagebuilder.com/addons/image/image1.jpg" alt="some alt text" />
<div class="title">
<span>Image Title</span>
</div>
</div>
</div>
</body>
</html>