There are many solutions to make the div fill the height of the remaining space of the browser window. We will discuss these solutions. But first, letβs look at the illustration of what we want to do.
We may use the flexbox property to fill the remaining height.
HTML:
div, and inside that div we created two other divs, one with the fixed height and one div which takes up the remaining height.CSS:
Lines 1β5: We set the outer div properties.
Lines 7β10: We set the background color and height of the div, which is fixed.
Lines 12β15: We set the properties of the div, which takes up the remaining height.
We apply the property of tables to utilize the space between the rows and assign some fixed heights to some elements, filling the remaining space with other elements.
HTML:
div and inside that div we made two other divs, one with the fixed height and one div which takes up the remaining height.CSS:
Lines 1-5: We set the outer div properties.
Line 7-10: We set the background color, display, and height of the div, which is fixed.
Line 12-15: We set the properties of the div, which takes up the remaining height.
With the help of absolute positioning, we stretch the divs between the two given heights.
HTML:
div, and inside that div we made two other divs, one with the fixed height and one div which takes up the remaining height.CSS:
Lines 1-5: We set the outer div properties.
Lines 7-10: We set the background color and height of the div which is fixed.
Lines 12-15: We set the properties of the div which takes up the remaining height.