There is the following HTML:
body {
padding: 10px;
border: 2px solid black;
margin: 2px;
}
.div1 {
height: 50px;
border: 2px solid black;
}
.div2 {
/* height: ??? */
border: 2px solid black;
margin-top: 2px;
margin-bottom: 2px;
}
<body>
<div id="div1" class="div1"></div>
<div id="div2" class="div2"></div>
</body>
The height of div1
should be always static 50px, the rest of parent space should be filled with div2
. For example,
if body.height == 700px then
div1.height = 50px
div2.height = 650px
How to define and set this dynamic height for the div2
?