div自动适应屏幕或父组件高度

不知道为什么,如果使用height:100vh;的话,会有上下的滚动条
像这样写,左右和上下都不会撑开滚动条

.header {
  display: flex;
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  bottom: 0;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
posted @ 2025-01-09 08:59  xxxichenjq  阅读(43)  评论(0)    收藏  举报