我是CSS的新手,在设置网页以使其完全适合屏幕尺寸时遇到了一些困难,但它不适合并出现滚动条。我已经尝试了这里提到的所有方法,但是没有一个起作用。我的网页或多或少看起来像这样。当我用
html{
height: 100vh;
}
body{
width: 100%;
height: 100vh;
background-color: #ffffff;
font-family: gothambook;
position: fixed;
top: 0;
bottom: 0;
}
Run Code Online (Sandbox Code Playgroud)
滚动条没有出现,但是内容在屏幕下方,不可见
Gen*_*ene 13
html {}
body {
height: 95vh;
}
Run Code Online (Sandbox Code Playgroud)
vh 代表视图高度,因此 97vh 是视图/浏览器高度的 97%。
https://css-tricks.com/fun-viewport-units/
出于某种原因,100vh 使它滚动了一点。
如果您想完全禁用滚动,那么您可以仅用此替换您的样式
html {
overflow: hidden;
}
Run Code Online (Sandbox Code Playgroud)