html - Bootstrap jumbotron full height without navbar's height -


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 simple hero unit, simple jumbotron-style component calling attention 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 browsers not support vh unit */     min-height: 100vh; /* these 2 lines counted 1 :-)       */      display: flex;     align-items: center; }  .btn-jumbotron{     background-color: black;     border-color: white; } 

i'm trying have jumbotron have full height of browser's window, without height of static navbar. did size of full viewport using height: min-height:100vh amnd center it, can see jsfiddle example have scrollbar present because of navbar's height - 64px.

how can remove that?

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

use calc

.vertical-center { min-height: 100%;  /* fallback browsers not support vh unit */ min-height: 100vh; /* these 2 lines counted 1 :-)       */  min-height: calc(100% - 64px);  /*  */ min-height: calc(100vh - 64px); /* */  display: flex; align-items: center; 

}


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -