CSS - div height calculation without "calc" -
in website, using 2 divs should have height in picture.
so, there div height:90px; aligned bottom of window, can if want 2nd div (red) "fill" rest of window? red div should have height of window minus height of blue div calc(100vh - 90px) wouldn't work, right?
thanks!
actually height: calc(100vh - 90px); does work
html, body { min-height: 100%; } * { margin: 0; padding: 0; } footer { height: 90px; background: blue; } main { background: red; height: calc(100vh - 90px); } <main></main> <footer></footer> however, it's not entirely clear how want react if content cause vertical scrolling. then not answer, probably.
alternative solution flex-box
html, body { min-height: 100%; } * { margin: 0; padding: 0; } .wrap { display: flex; flex-direction: column; flex-wrap:no-wrap; min-height:100vh; } main { background: red; flex:1; } footer { flex-basis:90px; flex-shrink:0; background: rgba(0, 0, 255, 1); } <div class="wrap"> <main> <div class="content"></div> </main> <footer> </footer> </div>
Comments
Post a Comment