I'm trying to vertically align the images in image containers that are laid out side by side.
However, when I applied the align-self: center
to the children, the second-to-last parent becomes a little misaligned.
I've been trying different ways to correct this, but unless I stop using display: flex
on the child image the issue will reappear.
The issue seems to be the car images are originally 37.5px height and 50px width, but the view more has 50px height and width. However, I think that difference should be taken care of in the parent's code where height and width are both set to 50px. But in the page inspect element tells me the car image parent height is 3px less than the following container.
.imageContainer {
height: $thumbnail_image_side_length;
width: $thumbnail_image_side_length;
margin-left: auto;
margin-right: auto;
display: inline-flex;
box-sizing: border-box;
}
img {
width: 100%;
height: auto;
overflow: hidden;
box-sizing: border-box;
display: flex;
align-self: center;
}
<button onClick={method here}>
<div className="imageContainer">
<img src={} alt='thumbnail' />
</div>
<p>{text here}</p>
</button>
This is what it looks like in the page: