【发布时间】:2016-11-26 15:14:02
【问题描述】:
我遇到了图像以不同的高度显示且下方的文字未对齐的问题。 这是标记,我有一个六行容器来显示 6 个图像
<div class="row">
<div class="posts">
<img src="images/bond.jpg" alt="quantum of solace">
<h3 class="title">Quantum of Solace</h3>
<p class="post-info">PG13 | 106min</p>
</div>
</div>
我将每个帖子设置为 14%,因为其中有 6 个帖子允许 2.5% 的保证金。我试图将图像包装在一个 div 中并将其设置为溢出隐藏,但没有奏效。
.row {
width: 100%;
}
.posts {
width: 14%;
float: left;
margin-right: 2.5%;
}
.posts img {
width: 100%;
max-width: 100%;
border-radius: 0.5em;
}
【问题讨论】:
-
在this fiddle 中似乎可以正常工作。您可以发布一个演示该问题的 sn-p 吗?
-
是的,但是你使用的图像都是相同的比例,我的不是
-
Ehm...所以您的抱怨是具有不同高度的图像以不同的高度显示?那不是很清楚。那你想要什么?是否要垂直拉伸某些图像以适应其他图像的高度?
标签: css image alignment height overflow