高度:计算(100vh - 76px);无法正常工作

问题描述 投票:0回答:1

当其他元素使其变长时,我的左侧菜单不会填满整个页面。通常情况下它工作得很好: when site is full size 。但是当我把它缩小时,会出现一个空白: smaller site, theres a blank below

width: 180px;
height: calc(100vh - 76px);
z-index: 700;
background-color: white;
padding: 20px 0;

display: flex;
flex-direction: column;
justify-content: space-between;

由于左侧菜单上方的导航栏,有“-76px”,我尝试使用最小高度或 100% 而不是 100vh,但没有任何效果。有人可以解决吗?

html css web-applications
1个回答
0
投票

所以我猜你正在尝试制作一个侧边栏,这样你就可以固定位置属性。您可以在下面添加此代码:

position: fixed;
top:0;
bottom:0;

然后重新调整代码,以便其他元素在侧边栏之后开始。 为了清楚起见,请提供更多代码

© www.soinside.com 2019 - 2024. All rights reserved.