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

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -