Having an issue with height in my code. My footer is set up like this:
<html>
<body>
<div class='wrap'>
<div class=principal></div>
<div class='clear'></div>
<footer><img alt='Logotype' /></footer>
</div>
</body>
</html>
html,body{
height:100%;
};
.wrap{
height:auto!important;
height:100%;
min-height:100%;
width:100%;
}
.clear{
clear:both;
}
footer{
position:absolute;
bottom:0;
height:50px;
width:100%;
}
Another approach would be adding margin: 0 auto -50px to the .wrap and moving the footer outside of it.
I want the .principal element to take up the full height, especially when there isn't much content, as I have a component injecting a
<div style='height:100%>insert text and graphics/charts here</div>
into it.
Check out the examples below for better clarity:
Image 1:
The content (.principal) should occupy 100% height due to the component. When a menu opens, it should match the size of the content (.principal), while keeping the footer at the bottom.
Image 2:
If there's more content (whether text or other elements), a scroll should appear while making the footer disappear and keeping the header fixed.
Image 3:
At the end of the scroll, the footer should be visible. When the menu is open, it should match the height of the displayed content (i.e., height = window-height-footer).
Is there a way for an element to have a dynamic height of 100%, expanding when necessary?
Challenges:
- Flexbox model can't be used due to IE8+ compatibility constraints.
- Height: calc won't work due to Safari and IE limitations.
- Can't set everything to height:100% because of the footer.
- Unable to include images due to reputation reasons.