html - Fixed div and fluid height div under -


i have fixed header height , subheader, want subheader fill whole page, when that, there’s slight offset causing scrollbar appear resize window in height:

header {    width: 100%;    height: 55px;    z-index: 10;    background: #263238;  }  .sub-header {    background: #37474f;    height: 95vh  }
<header></header>  <div class="sub-header"></div>

i’ve googled , googled , can’t find answer.

the 2 height settings not equate 100%. 95vh leaves 5vh, header set 55px, such, instead of 95vh sub header, calc(100vh - 55px).

you need ensure body not have margin set.

body{      margin:0;  }  header {      width: 100%;      height: 55px;      z-index: 10;      background: #263238;  }    .sub-header {      background: #37474f;      height: calc(100vh - 55px)  }
<header></header>  <div class="sub-header"></div>


Comments

Popular posts from this blog

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -

SQL Server - MyCTE query based on 24 hour period (next day) -