gpt4 book ai didi

html - Bootstrap jumbotron 全高没有导航栏的高度

转载 作者:行者123 更新时间:2023-11-28 15:22:45 27 4
gpt4 key购买 nike

HTML:

<!-- Static navbar -->
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Home</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>


<div class="jumbotron jumbotron-fluid vertical-center">
<div class="container">
<h1 class="display-3">TITLE</h1>
<p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
<hr class="my-4">
<p>Description text</p>
<p class="lead">
<a class="btn btn-primary btn-lg btn-jumbotron" href="#" role="button">Learn more</a>
</p>
</div>
</div>

<div class="container">

</div> <!-- /container -->

CSS:

.navbar{
padding: 7px 0;
margin-bottom: 0;
}

.jumbotron {
background-image: url(http://cdn.wallpapersafari.com/97/93/UE7u4i.jpg);
background-size: cover;
color: white;
margin: 0;
}

.vertical-center {
min-height: 100%; /* Fallback for browsers do NOT support vh unit */
min-height: 100vh; /* These two lines are counted as one :-) */

display: flex;
align-items: center;
}

.btn-jumbotron{
background-color: black;
border-color: white;
}

我正在尝试让超大屏幕具有浏览器窗口的完整高度,但没有静态导航栏的高度。我确实通过使用 height: min-height:100vh amnd 将其调整为完整视口(viewport)的大小,但是正如您从 jsfiddle 示例中看到的那样,由于导航栏的高度,我有一个滚动条 - 64px

我怎样才能删除它?

https://jsfiddle.net/iDaniel19/12qxmkjt/

最佳答案

使用计算

.vertical-center {
min-height: 100%; /* Fallback for browsers do NOT support vh unit */
min-height: 100vh; /* These two lines are counted as one :-) */

min-height: calc(100% - 64px); /* */
min-height: calc(100vh - 64px); /* */

display: flex;
align-items: center;

关于html - Bootstrap jumbotron 全高没有导航栏的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45785795/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com