我有一个固定宽度的容器和3幅不同宽度和高度的图像。我努力实现的目标是:
对预期结果的说明:

怎么做呢?
发布于 2019-02-05 20:45:51
您可以为图像定义通用的固定高度和自动宽度,并在容器上使用flex和justify-content: space-between。
html, body {
margin: 0;
}
.container {
display: flex;
justify-content: space-between;
}
.container>img {
height: 120px;
width: auto;
}<div class="container">
<img src="https://placehold.it/300x200/fa0">
<img src="https://placehold.it/160x300/0fa">
<img src="https://placehold.it/500x180/f0a">
</div>
发布于 2019-02-05 20:25:01
为容器添加此样式:
.container {
display: flex;
justify-content: space-between;
}这不重要你的图像的宽度和高度
https://stackoverflow.com/questions/54542331
复制相似问题