javascript - 使用 bootstrap 3 使 div 背景图像响应

标签 javascript jquery html css twitter-bootstrap

如何使用 bootstrap 3 使带有背景图像的 div 响应??

是否可以在 bootstrap 3 中使用 img-responsive 类??

我的 div 是空的,如下所示:

<div class="row">
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="workflowstep workflowstep1 img-responsive">&nbsp;
        </div>
        <div class="workflowstep workflowstep2 img-responsive">&nbsp;
        </div>
        <div class="workflowstep workflowstep3 img-responsive">&nbsp;
        </div>
        <div class="workflowstep workflowstep4 img-responsive">&nbsp;
        </div>
        <div class="workflowstep workflowstep5 img-responsive">&nbsp;
        </div>
        <div class="workflowstep workflowstep6 img-responsive">&nbsp;
        </div>
    </div>
</div>

最佳答案

我认为使用 img-responsive 并非如此在这里,因为它是 <img />

并制作 div背景图片响应式,我们可以使用background-size: cover;

background-size: cover;

Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area

关于javascript - 使用 bootstrap 3 使 div 背景图像响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19752749/

相关文章:

javascript - 如何根据选择输入使用javascript更改页面内容?

javascript - 根据单元格值更改行对齐 - Google 脚本

javascript - Firebase 匿名登录表单提交问题

javascript - 图像叠加网格

html - 如何将标准文本标签转换为悬停按钮?

javascript从元素到数组获取文本

javascript - 如何将百分比添加到 JavaScript 中的百分比宽度?

javascript - 文件下载完成后如何关闭模态对话框

jquery - 将 Rails 变量插入 jquery

javascript - 如何检查我的元素 ID 是否具有焦点?