【问题标题】:How to make a fullscreen image on bootstrap?如何在引导程序上制作全屏图像?
【发布时间】:2016-04-24 01:15:21
【问题描述】:
【问题讨论】:
标签:
html
css
twitter-bootstrap-3
【解决方案1】:
你用这个来填充标签:
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
【解决方案2】:
基于这个article,你只需要定义一个带有id的div,然后像这样把图片放在里面:
<div id="bg">
<img src="yourimg.jpg" alt="">
</div>
然后给出这个样式:
#bg {
position: fixed;
top: 0;
left: 0;
/* Preserve aspet ratio */
min-width: 100%;
min-height: 100%;
}
.back {
/* Set rules to fill background */
min-height: 100%;
min-width: 1024px;
/* Set up proportionate scaling */
width: 100%;
height: auto;
/* Set up positioning */
position: fixed;
top: 0;
left: 0;
}
这应该可以解决问题。
你可以看到这个并播放here (要全屏查看,只需点击“Auto-run js”旁边右上角的箭头)。