JS Fiddle I'm using a flex layout. I have a list:
HTML:
<ul>
<li><img src="....."></li>
....
</ul>
CSS:
ul{
list-style-type: none;
margin: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
}
li{
width: 25%;
display: flex;
}
img{
height: auto;
max-width: 100%;
}
The issue is, the images are being pulled to the full height - how can I maintain an image's aspect ratio? I also want all list elements to be the same height (to do this I have used display: flex
).