It certainly appears to be a bug.
The default setting for the align-items
property is stretch
. Most major browsers handle this sensibly, stretching the image within the confines of the container.
For whatever reason, Safari stretches the image to its natural height, taking the container along for the ride.
flex-direction: row
To fix the problem, override the stretch
default value with flex-start
in the align-items
property.
.container {
display: flex;
flex-direction: column;
}
.container section:first-child {
display: flex;
align-items: flex-start; /* new */
margin-bottom: 25px;
}
.container img {
width: 125px;
height: auto;
}
<div class="container">
<section>
<img src="http://i.imgur.com/60PVLis.png">
</section>
<section>
<img src="http://i.imgur.com/60PVLis.png">
</section>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…