Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Devops
  3. Question
Devops

Make A Div Fill The Height Of The Remaining Screen Space

Asked by Amit Jaisawal Nov 18, 2022 1.4K views 1 answer
Share

About this question

 I am working on a web application where I want the content to fill the height of the entire screen. The page has a header, which contains a logo, and account information. This could be an arbitrary height. I want the content div to fill the rest of the page to the bottom. I have a header div and a content div. At the moment I am using a table for the layout like so:

CSS and HTML
#page {
    height: 100%; width: 100%
}
#tdcontent {
    height: 100%;
}
#content {
    overflow: auto; /* or overflow: hidden; */
}   
...
...
        

The entire height of the page is filled, and no scrolling is required.

For anything inside the content div, setting top: 0; will put it right underneath the header. Sometimes the content will be a real table, with its height set to 100%. Putting header inside content will not allow this to work. Is there a way to achieve the same effect without using the table?

Your answer

1 Answer

More Devops discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest DevOps Blogs

Guides, tips and career advice on DevOps from JanBask experts.