I have the following HTML file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body style="margin: 0">
<div style="background-color: #1a1b26; height: 100vh">
<div
style="
background-color: #16161e;
color: #0db9d7;
height: 32px;
display: flex;
align-items: center;
padding: 8px;
font-family: Arial, Helvetica, sans-serif;
"
>
Header goes here
</div>
<div style="padding: 8px; height: 100%">
<div
style="
background-color: #16161e;
color: #0db9d7;
padding: 8px;
margin: 8px;
border-radius: 8px;
height: 100%;
font-family: Arial, Helvetica, sans-serif;
"
>
{Nested Container}
</div>
</div>
</div>
</body>
</html>
I would like to have a page, containing a div that limits everything to the viewport height. Then, I would like to add a header with a constant height (to prevent squishing the contents inside, wouldn't flex or % squish the text if the screen height is too small?).
Then I would like to have a div that will fill the remaining space in the 100vh
, I've tried height:100%
, and it overflows down. Is there a way for this, while avoiding calc()
?
The following is the jsfiddle I've added to show the displayed result: https://jsfiddle.net/ChronoAero/mqn081cw/
Thanks.