nigelh70638339 wrote The Title part of the page is now spread over 2 lines, they do not fit above the image as they would in a table. I have tweaked a few of your pieces of code and I think that this is the only piece left to sort. Again, thank you! |
Flexbox responsive solution:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Flexbox Grid</title>
<style>
.image_gallery_wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
width: 95%;
max-width: 1200px;
margin: 0 auto;
}
@media screen and (max-width: 768px) {
.image_gallery_wrapper {
justify-content: space-between;;
}
}
.gallery_thumbnail {
width: 19%;
margin: 0 0.5% 15px 0.5%;
padding: 20px 0;
text-align: center;
background-color: #f2f2f2;
}
@media screen and (max-width: 1000px) {
.gallery_thumbnail {
width: 31%;
margin: 0 1% 15px 1%;
}
}
@media screen and (max-width: 768px) {
.gallery_thumbnail {
width: 48%;
}
}
@media screen and (max-width: 480px) {
.gallery_thumbnail {
width: 100%;
margin: 0 0 15px 0;
}
}
.gallery_thumbnail figure {
margin: 0;
padding: 0;
}
.gallery_thumbnail figcaption {
margin: 0;
padding: 0;
}
.gallery_thumbnail h4 {
font-size: 24px;
line-height: 34px;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div class="image_gallery_wrapper">
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
<section class="gallery_thumbnail">
<h4>Title</h4>
<figure>
Image
</figure>
<figcaption>Text for image</figcaption>
</section>
<!-- end gallery_thumbnail -->
</div>
<!-- end image_gallery_wrapper -->
</body>
</html>