响应式 Bootstrap Jumbotron 背景图像 [英] Responsive Bootstrap Jumbotron Background Image
本文介绍了响应式 Bootstrap Jumbotron 背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 bootstrap jumbotron,并包含背景图像.调整屏幕大小会使图像平铺并重复,而我希望响应地调整图像大小.
<div class="jumbotron" style="background-image: url(http://www.californiafootgolfclub.com/static/img/footgolf-1.jpg); background-size: 100%;"><div class="container for-about"><h1>关于</h1>
您将如何使图像具有响应性?网站在这里.感谢您的想法!
解决方案
最简单的方法是设置 background-size
CSS 属性cover
:
.jumbotron {背景图片:网址(../img/jumbotron_bg.jpg");背景尺寸:封面;}
I'm using bootstrap jumbotron, and including a background image. Resizing the screen makes the image tile and repeat, whereas I want the image to be responsively resized.
<div class="jumbotron" style="background-image: url(http://www.californiafootgolfclub.com/static/img/footgolf-1.jpg); background-size: 100%;">
<div class="container for-about">
<h1>About</h1>
</div>
</div>
How would you go about making the image responsive? The site is HERE. Thanks for your ideas!
解决方案
The simplest way is to set the background-size
CSS property to cover
:
.jumbotron {
background-image: url("../img/jumbotron_bg.jpg");
background-size: cover;
}
这篇关于响应式 Bootstrap Jumbotron 背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文