I want to make my <html>
and <body>
tags be the entire height of the viewport if the page isn't tall enough to warrant scrolling, or the entire height of the web page if it does.
At the moment I'm using this CSS:
html, body {
height: 100%;
}
Which works a treat if the web page isn't tall enough for the user to scroll, however on a long webpage it only goes to the height of the viewport on the users browser. I also tried:
html, body {
min-height: 100%;
}
but that just seems to have the same effect as having no height
declaration at all.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…