我有以下CSS代码:
.hero {
position: relative;
padding: 60px 0 60px 0;
min-height: 900px;
background: rgb(40, 70, 102) url('../img/hero-01.jpg') no-repeat center center;
background-size: cover;
color: #fff;
}
这样一来,覆盖率就达到了100%的宽度,但只有900px的高度。我尝试添加,height: 100%
但是没有用。到目前为止,该网页看起来是这样的http://i.imgur.com/RMyIO4Y.jpg,并且当用户将浏览器调整为全屏尺寸时,我想使“视频”部分不可见。我怎样才能做到这一点?谢谢。
您还可以将高度设置为
height: 100vh;
http://caniuse.com/#feat=viewport-units
英雄模板的示例CSS:
.hero {
position: relative;
padding: 60px 0 60px 0;
min-height: 100vh;
background: rgb(40, 70, 102) url('../img/hero-01.jpg') no-repeat center center;
background-size: cover;
color: #fff;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句