我在我的网站上使用引导带,我想让类jumbotron
的元素占据完整的用户窗口。然后,用户可以滚动到网站的其余部分。
目前,我与以下方面开展了合作:
CSS:
jumbotron { height: 100vh;}
HTML:
<div class="row">
<div class="jumbotron">
...
</div>
</div>
... rest of site ...
但我想要愚弄我的网站,使其尽可能可靠,并希望使用一个更广泛接受的方式。
发布于 2016-11-04 09:56:40
您需要将container-flud
设置为jumbotron
class
之前的全屏高度,创建一个类并给出类似于.fullS_height {height: 100vh;}
的样式
HTML:
<div class="container-flud">
<div class="jumbotron fullS_height">
<h1>Bootstrap Tutorial</h1>
<p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.</p>
</div>
<p>This is some text.</p>
<p>This is another text.</p>
</div>
CSS:
.fullS_height {
height: 100vh;
}
.fullS_height {
height: 100vh;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-flud">
<div class="jumbotron fullS_height">
<h1>Bootstrap Tutorial</h1>
<p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.</p>
</div>
<p>This is some text.</p>
<p>This is another text.</p>
</div>
发布于 2016-11-04 09:52:44
您需要做的是将jumbotron
的每个父级提供给html
CSS属性height:100%
;
示例
html, body, .container, .row, .jumbotron {
height: 100%;
}
<html>
<head>
</head>
<body>
<div class="container">
<div class="row">
<div class="jumbotron">
...
</div>
</div>
</div>
</body>
</html>
请记住,<body>
只适用于标记之后的元素。
https://stackoverflow.com/questions/40428882
复制相似问题