在使用element-ui组件时,想要侧边栏的高度占满屏幕的左侧边栏,单纯在样式中设置了height:100%,然而并不生效。
.el-menu {
height: 100%;
border: none;
h3 {
color: #fff;
text-align: center;
line-height: 48px;
}
}
解决方案:
当想要元素铺满整个屏幕的时候,采用绝对定位或者固定定位
定位+width:100%;height:100%
.el-menu {
position: fixed;
height: 100%;
border: none;
h3 {
color: #fff;
text-align: center;
line-height: 48px;
}
}
这样,左侧边栏就可以铺满整个左侧边的屏幕了。