【发布时间】:2017-09-02 00:16:00
【问题描述】:
我正在尝试使用 Bootstrap 和 Flexbox 设置一个画廊的样式,其中有一个大图像,旁边是两个较小的堆叠图像,并且两者的高度相同。
容器列似乎在完成它们的工作并保持相同的高度,但我需要列中的img 来填充容器的高度。
如果我在 img 上使用 height: 100%,它可以在 Firefox 中运行,但这在 Chrome 和 Safari 中都会中断。
img {
max-width: 100%;
width: auto\9;
height: auto;
vertical-align: middle;
border: 0;
-ms-interpolation-mode: bicubic;
}
figure {
margin-bottom: 0;
}
.rts-col {
margin-bottom: 30px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="rts-col col-8">
<figure>
<img src="http://via.placeholder.com/1400x933">
</figure>
</div>
<div class="rts-col col-4">
<figure style="margin-bottom: 30px;">
<img src="http://via.placeholder.com/1400x933">
</figure>
<figure>
<img src="http://via.placeholder.com/1400x933">
</figure>
</div>
</div>
</div>
【问题讨论】:
-
@Paulie_D 我没有意识到我可以将代码插入到关于 SO 的问题中。我刚刚更新了我的问题以包含最少的代码标记。
标签: css flexbox bootstrap-4