【发布时间】:2022-01-06 01:26:43
【问题描述】:
我在一个 div 中有三张图片,其中一张的高度比其他的高。 我可以“告诉”所有图像的高度不超过它们所在 div 的 50%/70%,那么,具有较大高度的图像会相应地改变吗?
<div class="images">
<img src="https://images-us.bookshop.org/ingram/9781640094765.jpg?height=500&v=v2" alt="a book">
<img src="https://images-us.bookshop.org/ingram/9781565842632.jpg?height=500&v=v2" alt="a book">
<img src="https://images-us.bookshop.org/ingram/9780805050271.jpg?height=500&v=v2" alt="a book">
</div>
css
.images {
display: flex;
justify-content: space-around;
align-items:flex-end;
border: 5px solid blue;
}
.images img {
max-height: 50%;
}
【问题讨论】: