【发布时间】:2022-01-09 07:43:58
【问题描述】:
我想使用 bootstrap4 在顶部右侧显示图像,但不知道如何调整图像高度以满足与左侧部分相同的高度(保持比例)
代码(想删除200px)
<div class="container">
<div class="row">
<div class="col-sm">
<div class="alert alert-success">
why cannot I still use table for this kind of tasks? why cannot I still use table for this kind of tasks?
</div>
<div class="alert alert-info">
It is end of 2021
</div>
<div class="alert alert-info">
Now I'd updated to div, this contents can have more text
</div>
</div>
<div class="col-sm">
<img width="200px" src="https://www.codeply.com/images/partner_creativetim.png" />
</div>
</div>
</div>
【问题讨论】:
-
我对你想要做什么有点困惑......你介意再解释一下吗?
-
2021 年底的表格布局...这是你的第一个问题
-
@Kameron 当我调整网页大小时,左边部分(文本)可以换行,高度可以改变,我希望图像的高度可以自动调整,但需要保持比率现在改变了
-
是的。如果您使用行和列而不是表格,那么整个图像业务将非常容易。
-
@LarryCai 我同意 Alvaro 的说法,你必须使用表结构吗?如果没有,我可以用 div 的解决方案来回答。
标签: css bootstrap-4