I have a DIV that I want to touch the bottom of the screen (for appearance reasons). Sometimes the content is enough tall to do that, but sometimes the content is too short and the DIV won't touch the bottom of the screen. Is there a simple workaround?
If you set min-height to 100% for the DIV, you also need to include:
body, html { height:100% }
Elements expand to the size of their container, so make sure the container (being the page itself) has a height of 100% as well.
For anyone reading this later (as I am) you can use
min-height: 100vh;
The vh
unit stands for viewport height and is a percent of the screen size.
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