How to make a div fill its container with 100% width and height?

advertisements

This question already has an answer here:

  • Make a div fill the height of the remaining screen space 30 answers

I am creating a text editor, and I am working on the sizing of my div. Unfortunately, it does not take up the whole page. Its width and height are set to 100%. Here is the CSS:

html, body {
    position:absolute;
    z-index:1;
    top:0px;
    left:0px;
}

If you would like to view the page, you can see it here. Thank you all so much for your help.


The reason it's not taking up the entire height is because the parent objects are most likely not 100% as you would like. Place the following code before the container style:

 html,body{
width: 100%;
height: 100%;
}