Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9221507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:35:40+00:00 2026-06-18T03:35:40+00:00

Assume the following html: <!DOCTYPE html> <html> <head> <meta charset=utf-8> </head> <body> <div id=header>

  • 0

Assume the following html:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <div id="header">
            <!-- dynamic height -->
        </div>
        <div id="main" style="overflow: scroll;">
            <!--
                contains actual content
                height should be whatever is left over
            -->
        </div>
        <div id="footer">
            <!-- dynamic height -->
        </div>
    </body>
</html>

basically what I want is:

main height = body height - (header height + footer height)

The body and html height is 100%.

As both the height of header and footer are dynamic (will change very frequently), I need a dynamic way to set the height of main, i.e, I can’t specify any of the heights in pixels or percentages.

There are indeed other similar questions, but I am not looking for a “floating/sticky footer”, the main div must have the remaining height.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:35:41+00:00Added an answer on June 18, 2026 at 3:35 am

    You MUST specify the height of the footer and the header.

    You can use javascript on document ready to set the height of the footer, header and then the main div.

    Then, use css like this :

    #header{
      position: absolute;
      top: px;
      height: /*dynamically set by javascript*/;
      left: px;
      right: px;
    }
    
    #footer {
      position: absolute;
      bottom: 0px;
      height: /*dynamically set by javascript*/;
      left: 0px;
      right: 0px;
    }
    
    #main {
      position: absolute;
      bottom: /* set by javascript with height of footer */;
      top: /* set by javascript with height of header */;
      left: 0px;
      right: 0px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume following html page: <html> <head></head> <body> <div id=wrapper> <div id=header/> <div id=navigation/> <div
Assume I have the following html: <html> <head> </head> <body> <div id=wrapper > <div
Lets assume the following HTML <div id=main> <div id=a></div> <div id=b></div> <div id=c></div> <div
Assume we have the following html: <html> <body> <a href="/1234.html">TEXT A</a> <a href="/3243.html">TEXT B</a>
Assume I have the following HTML - <DIV id=ParentDiv> <DIV id=SubDiv1></DIV> <DIV id=SubDiv2> <INPUT
Assume the following situation <div> <div1> <divA> </divA> <divB> </divB> </div1> <div2> </div2> </div>
Ilets assume i have the following HTML <a class='x y'>A</a> <a class='x '>B</a> <a
I have the following html code : <div class=submit><input type=button name=getResult value=Get Comments class=sbutton
Assume the following is a subset of the HTML document... note there are multiple
Given the following beginning of an HTML email body, how old is their version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.