我将演示页面分为 10 个列表项,每个列表项使用 10% 的宽度和 400 像素的高度。但是我希望每个列表项以覆盖整个屏幕的 100% 高度显示。我正在尝试设置列表项的高度,但是当我使用 'height:100%' 时,列表项继续消失。我该如何管理?
HTML
<div class="container">
<ul class="cbp-rfgrid">
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
<li><a href="#"><div><h3>Felis catus</h3></div></a></li>
</ul>
</div>
CSS
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
background-color:#03F;
}
.container {
height: 100%;
}
.cbp-rfgrid {
margin: 0;
padding: 0;
list-style: none;
position: relative;
width: 100%;
}
.cbp-rfgrid li {
position: relative;
float: left;
overflow: hidden;
width: 10%; /* Fallback */
width: -webkit-calc(100% / 10);
width: calc(100% / 10);
height:400px; /* CURRENT HEIGHT, SHOULD BE 100% BROWSER HEIGHT */
}
.cbp-rfgrid li a {
display: block;
width: 100%;
cursor: pointer;
}
.cbp-rfgrid li a div {
position: absolute;
left: 0px;
top: 0px;
right: 0px;
bottom: 0px;
background: rgba(71,163,218,0.5);
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: flex;
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
align-items: center;
text-align: center;
opacity: 0;
}
.cbp-rfgrid li a:hover div {
opacity: 1;
}
.cbp-rfgrid li a div h3 {
width: 100%;
color: #fff;
text-transform: uppercase;
font-size: 1.4em;
letter-spacing: 2px;
padding: 0 10px;
}