I need to specify min-height at several places so I did this,
body{
min-height = 100vh;
}
But it's not working, it's not doing anything. How can I fix it?
Because you're looking for min-height: 100vh
instead of min-height = 100vh
.
Also note that <body>
adds 8px
of margin
by default, so if you don't want any scrollbars, you'll also need to offset this with margin: 0
when using viewport-relative lengths :
body { min-height: 100vh; background: red; margin: 0; }
Hope this helps! :)
CSS uses colon to assign values. Using min-height: 100vh;
should work fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.