我正在尝试将#app设置为100%高度,但无法实现。div #app不被认为是Body的孩子吗?我每次都会遇到这个问题,每次我都必须以一种不同的方式工作。
有没有办法完全避免这种情况发生?CSS:
* {
margin: 0;
padding: 0;
font-family: "Nunito";
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html {
height: 100%;
}
body {
transition: background 0.25s ease-in-out;
min-height: 100%;
}
#app {
max-height: 100%;
min-width: 100%;
position: relative;
}
发布于 2020-04-21 07:36:55
您可以使用视口高度单位来解决此问题,它们根据整个视口的高度工作。
#app {
height: 100vh;
}
发布于 2020-04-21 07:05:14
这不是vue问题,但很可能在CSS Height %问题下,您可能需要声明下面的代码为height:100%才能为您的div工作
html, body {
margin:0;
padding:0;
height:100%;
}
P/S:也许是时候尝试一下flexbox
了
发布于 2021-09-30 19:06:11
我的任务是-最大身体宽度- 1980px。可能会删除宽度限制。
html {
max-width: 1980px;
margin: 0 auto;
height: 100%;
}
body {
font-family: Arial sans-serif;
color: $textcolor;
margin: 0;
padding: 0;
width: 100%;
max-width: 1980px;
min-height: 100%;
display: flex;
justify-content: stretch;
align-items: stretch;
}
#app {
height: inherit;
width: inherit;
}
https://stackoverflow.com/questions/61333301
复制相似问题