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 8697241

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:28:32+00:00 2026-06-13T01:28:32+00:00

I want a 100% height div with absolutely positioned divs inside it. For whatever

  • 0

I want a 100% height div with absolutely positioned divs inside it. For whatever reason when I add the child divs, the height of the parent div shrinks to the static content size.

To clarify, I do not want the absolutely positioned elements to be full-height. Just the containing div.

I have (simplified) markup as follows:

<div id="content">
   <div id="dashboard">
      Some text
      <div class="widget"></div>
      <div class="widget"></div>
      ...
   </div>
</div>

And the styling:

#content {
  min-height: 100%;
}
#dashboard {
  min-height: 100%;
  height: 100%;
  position: relative;
}
.widget {
  height: 50px; /* arbitrary */
  width: 50px;
  position: absolute;
}

I have put #content and #dashboard as min-height 100% and height 100% and that works. If I comment out the absolutely positioned divs, both are the full height of the screen.

But when I add the .widgets, #content is still full height (good) but #dashboard becomes only the height of ‘some text’. For whatever reason, adding absolutely positioned content to #dashboard changes its height.

Note (edit)

I don’t want #content to be 100% height because it needs to grow
with content on other pages. I only want #dashboard to be exactly 100%
height.

jQuery works, but I’d like to do it with css only

$("#dashboard").height( $("#content").height() );

Also I tried changing the type of display to block or inline for #content and setting -moz-box-sizing to default because I read it can break min-height for Firefox.

Any idea how to fix this?


Similar but not the same: How to set 100% height of a parent div with absolutely positioned children (not a duplicate)?

  • 0 0 Answers
  • 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-13T01:28:35+00:00Added an answer on June 13, 2026 at 1:28 am

    From the MDN:

    A percentage value for min-height property is calculated with
    respect to the height of the generated box’s containing block.
    If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the percentage value is treated as 0.

    Hence, you’ll need to specify the height of the #content element explicitly to get min-height property of #dashboard element to work.

    Thus, try using height property for #content instead of min-height:

    #content {
      height: 100%;
    }
    

    Here is a jsDiddle Demo.

    html, body {
        height: 100%;
    }
    #content {
      height: 100%;
    }
    #dashboard {
      min-height: 100%;
      position: relative;
    }
    .widget {
      height: 50px; /* arbitrary */
      width: 50px;
      position: absolute;
    }​
    
    <div id="content">
       <div id="dashboard">
          Some text
          <div class="widget"></div>
          <div class="widget"></div>
          ...
       </div>
    </div>​
    

    UPDATE

    I don’t want #content to be full-size at all times.

    Then, you’ll need to use a fixed height for the #content:

    #content {
      height: 200px;  /* or whatever you want */
    }
    
    #dashboard {
      height: 100%;   /* or inherit */;
    }
    

    Else, you should use JavaScript to calculate the needed height and apply that to the #dashboard element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to have an element inside a div set to height 100%. The
What I want: <div style=overflow:scroll;width:100%;height:50%;> &nbsp; <div style=height:500px;width:400px;border:solid 3px red;> </div> </div> <div style=overflow:scroll;width:100%;HEIGHT:50%;>
I want to have an inner div that sites inside different sized container divs,
Basically, I want an outer DIV's height to be dictated by its inner DIVs
I want to add 100 entry to users table numbers field, random characters length
I want to covert a point, positioned in one DIV into a point wrt
i want to have divs in one div and they need to be in
I want a div's width and height to change with the browser as the
I want the container div to expand to the height of the div's inner
<div class=container1></div> <div class=container2><div class=container2-inner></div></div> .container1 { height: 5000px; } .container2 { height: 100%;

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.