【发布时间】:2019-07-09 22:06:15
【问题描述】:
我在 img 标签中使用了img-fluid 类,但我的图像没有完全响应。小屏有反应,放大到一定尺寸后就没有反应了。
我已阅读 How to make an image responsive using bootstrap without having it take up the entire width of the division? 和 Bootstrap: img-responsive vs img-fluid 但无法解决问题。
这是我的尝试
HTML:
<!-- THE HEADER -->
<div class="container-fluid header">
AUST CSE
</div>
<!-- IMAGE JUST BELOW HEADER -->
<div class="wrapper" style="background: blue">
<img src="images2/banner.jpg" class="img-fluid">
</div>
CSS:
.wrapper {
width: 100%;
}
在较小的屏幕中,页面如下所示: 但是,在更大的屏幕上,图像不会占用 100% 的空间,看起来像这样: 我希望图像占据 100% 的宽度并放大其高度,就像屏幕较小时一样。
【问题讨论】:
-
您能否为您的代码创建一个工作示例,以便我们准确了解您使用的样式?
-
图片的实际宽度是多少?
标签: html css bootstrap-4