I have a problem regarding height. I have a footer following below:
<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%; }
There is another way that puts margin: 0 auto -50px in .wrap and puts the footer outside the wrapper.
I need .principal to have 100% height when there is not much content, because I have a component that introduces .principal a <div style='height:100%>insert text and graphics/charts here</div> .
See the examples below to better understand:
Image 1:
Content 100%
I need content (.principal) to have 100% height due to component. I have a menu that opens when clicked and should have a content size (.principal), I want a footer at the bottom of the page.
Image 2:
Content Scrolling
If there is more content (due to text or something else), I want the scroll and footer to disappear and the title fixed.
Image 3:
Picture
A footer should appear at the bottom of the scroll. When the menu is open, the menu should have a height of the size of the displayed content (in this case height = window-height-footer).
So, there is a way that an element can have 100% height, but when does a lot of content expand there?
Obstacles:
- I cannot use the flexbox model due to IE8 + (compatibility required).
- I cannot use height: calc due to Safari and IE.
- I canβt put everything in height: 100% due to the footer.
- I can not put images because of reputation.
source share