我正在使用twitter bootstrap carcass进行我的web项目开发.目前我有全屏幕背景图像,我为body标签设置如下:
body {
background: url('Content/images/planet.gif') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Run Code Online (Sandbox Code Playgroud)
它看起来不错,当我试图改变浏览器窗口大小时,调整大小完美.
现在我想通过添加背景轮播为我的网站添加一些视觉效果.有没有办法在整个背景下实现标准的bootstrap轮播?
我在这里找到了一个可能的解决方案,但令我困惑的是 - img标签用于不同的图像.我试图通过背景网址做同样的事情,但无法弄明白.
如果我正在使用,当浏览器大小发生变化时,如何消除空格background-size:contain;?
对于较小的浏览器尺寸,图像和文本之间的空白太多。网站是: http: //16debut.com/test.html
CSS 是:
body {
margin:0px 0px;
}
#hero {
background-clip: content-box;
background-image: url("imgtop.png");
background-size: contain;
background-repeat: no-repeat;
position: relative;
height: 235vh;
}
#content {
padding: 100px 50px;
text-align: center;
width: 80%;
margin: 0px auto;
}
#content h2 {
margin: 0px 0px 30px 0px;
}
#footer {
padding: 30px 0px;
text-align: center;
background: #ddd;
}
Run Code Online (Sandbox Code Playgroud)