I want to show an image with text next to the image. 3 images in a row. The following code example will wrap the text but I need it all to fit the width of the container.
I have seen that this can be achieved using a unordered list as well but I have not been able to figure that out either.
.banner-row {
display: flex;
}
.banner-column {
flex: 33.33%;
padding: 15px;
}
.banner-container {
display: flex;
align-items: center;
justify-content: center
}
banner-img {
max-width: 100%;
max-height:100%;
}
.banner-text {
font-size: 20px;
padding-left: 20px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
I then have the html code as follows:
<div class="banner-row">
<div class="banner-column">
<img src="https://cdn.shopify.com/s/files/1/0778/0778/0187/files/reduces-headaches-yellow.png" alt="Snow" style="width:33%"><div>Reduces Headaches</div>
</div>
<div class="banner-column">
<img src="https://cdn.shopify.com/s/files/1/0778/0778/0187/files/relieves-neck-pain-yellow.png" alt="Forest" style="width:33%"><div>Relieves Neck Pain</div>
</div>
<div class="banner-column">
<img src="https://cdn.shopify.com/s/files/1/0778/0778/0187/files/wake-up-refreshed-yello.png" alt="Mountains" style="width:33%"><div>Improves Sleep</div>
</div>
</div>```
[![Image shows the text wrapping][1]][1]
[1]: https://i.stack.imgur.com/wVYjL.png
3
Answers
Just add display: flex in banner-column it should work
to make them align center
Your banner text div elements had no classes in them. I added some code to style the body just to make it easier to see. I hope this code produces the results you want.