我有一张宽度为1300像素的图片,使用Bootstrap,我想让这张图片填满我的容器,容器的宽度设置为1300像素。我创建了一行,将其分为12列,并添加一个class为“image responsive”的图片。使用这种设置,我得到了下面的输出。
我希望我的图片能够一直延伸到我的内容中的图片所在位置,以下是我的代码。
<div class="row">
<div class="container">
<div class="col-md-12">
<img src="<?php bloginfo('template_directory'); ?>/assets/img/homeBanner.jpg" alt="placeholder 960" class="img-responsive"/>
</div>
</div>
</div>
图像的宽度被设置为100%,不确定为什么它没有填充容器。
row
类必须嵌套在container
类内,将顺序更改为.container > .row > .col
。 - Mehdi Dehghani