I have a couple of problems with my container DIV. For one it is not recognising the height of my content correctly (I would have thought it would extend beyond the bottom of the main content and sidebar, but it isn't). You can see what I mean on this page.
I would also like the container DIV to always fill the available height of the screen/window. I have tried setting it to min-height:100%
, but this didn't have any effect.
Here is the CSS I am using for the container DIV:
#container { padding: 0; margin: 0; background-color: #292929; width: 1200px; margin: 0 auto; min-height: 100%; }
I would be grateful for any help to get this working.
Thanks,
Nick
height: 100% gives the element 100% height of its parent container. height: auto means the element height will depend upon the height of its children.
For a responsive full page height, set the body element min-height to 100vh. If you set a page width, choose 100% over 100vw to avoid surprise horizontal scrollbars.
Add this to your css:
html, body { height:100%; }
If you say height:100%, you mean '100% of the parent element'. If the parent element has no specified height, nothing will happen. You only set 100% on body, but you also need to add it to html.
You can net set it to view height
html, body { height: 100vh; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With