How can an html element fill out 100% of the remaining screen height, using css only?

Harry

I have a header element and a content element:

#header
#content

I want the header to be of fixed height and the content to fill up all the remaining height available on the screen, with overflow-y: scroll;.

It this possible without Javascript?

BentOnCoding

The trick to this is specifying 100% height on the html and body elements. Some browsers look to the parent elements (html, body) to calculate the height.

<html>
    <body>
        <div id="Header">
        </div>
        <div id="Content">
        </div>
    </body>
</html>

html, body
{
    height: 100%;
}
#Header
{
    width: 960px;
    height: 150px;
}
#Content
{
    height: 100%;
    width: 960px;
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to fill 100% of remaining height?

How can I get the height of an element using css only

How to fill remaining height of container using flexbox?

css fill remaining height, only when children require

How to make several aspect ratio divs to fill remaining screen height?

How to set flexbox to fill the remaining height and be on the middle of the screen?

CSS fill parent height and remaining with

CSS Div fill remaining height

HTML CSS height 100% only goes as tall as the screen resolution, not the body height

How do you have an element fill the remaining height in vuetify 2.0?

Make a div fill the height of the remaining screen space

Flutter gridview fill remaining height on screen

How to fill remaining height and width?

html css fill a svg but only 50% height

How can I stretch the li elements to fill out 100% of their parent element ul?

How can I set the height of element to the actual required height of an HTML element, as opposed to auto in CSS or JavaScript?

Making a div fill 100% height of screen

css how to make columns auto fill background color to height 100%

Fill remaining vertical space - only CSS

How to make the main content div fill height of screen with css

How do I set a floating element automatically fill the remaining height of its parent element (height not fixed and displayed as a table)?

Set Flexbox Min Height To Fill Remaining Screen in Scrolling Container

Make a div fill the height of the remaining screen space when header is fixed

How can I make an element visible on a page only when the html content height is bigger than the viewport height?

How can i select an html element based on type and not hierarchy using only CSS

How to add scrollbars in a content area of a full screen web app i.e. 100% height of screen using CSS

Fill remaining height with Bootstrap

Fill remaining height sidebar

CSS: How to make div fill remaining height inside of a flex-child