I was meddling with vertical alignment in CSS, using a flexbox model, and there's a layout I'm struggling to fit:
The images in yellow have different max-height or max-width.
What I already did is:
.flex {
display: flex;
align-items: baseline;
justify-content: space-between;
}
img {
max-width: 100px;
}
.small {
max-width: 50px; /* for example, this could be 30 or 40 */
}
<html>
<body>
<div class="flex">
<div class="child">
<img src="https://www.google.fr/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" />
<p> Text </p>
<p> Text </p>
</div>
<div class="child">
<img src="https://www.google.fr/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" class="small" />
<p> Text </p>
</div>
<div class="child">
<img src="https://www.google.fr/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" />
<p> Text </p>
<p> Text </p>
</div>
</div>
</body>
</html>
The main issues with this code are:
- Images are not vertically centered (the center Google is a little lower than the other two)
- It would be cool to have the caption vertically centered, but a baseline model would suffice.
Is it possible to do this with flexbox? If not, what is a good way of doing it?