I am facing an issue with a fixed container that contains an absolute div. I am trying to set the height of the .absolute
div to be 100% of the container div (which has a height of 500px). This is crucial for creating a mobile menu with a toggle container, and it needs to be the height of the mobile phone screen.
Check out my solution on JSFiddle
Here is the HTML structure:
<div class="container">
<div class="fixed">
<div class="absolute">
</div>
</div>
</div>
And the CSS styles:
.container{
width:100%;
height:500px;
background-color:#ddd;
}
.fixed{
position:fixed;
width:100%;
height:50px;
background-color:red;
top:8px;
left:8px;
right:15px;
}
.absolute{
position:absolute;
height:100%;
width:100%;
background-color:green;
top:51px;
left:0px;
}