使用css/html和“创建固定侧栏和固定菜单栏”;“浏览器选择的宽度/高度”;
我想创建一个固定的侧栏和菜单栏,以及一个内容页,如使用引导的示例所示: 对于菜单栏,我使用以下css(可以使用) 但是侧边栏应该使用什么css呢?因为我不知道菜单栏的高度(我不想显式设置它,但让浏览器选择)。如何将侧边栏附加到菜单栏的底部使用css/html和“创建固定侧栏和固定菜单栏”;“浏览器选择的宽度/高度”;,css,bootstrap-4,angular-ui-bootstrap,Css,Bootstrap 4,Angular Ui Bootstrap,我想创建一个固定的侧栏和菜单栏,以及一个内容页,如使用引导的示例所示: 对于菜单栏,我使用以下css(可以使用) 但是侧边栏应该使用什么css呢?因为我不知道菜单栏的高度(我不想显式设置它,但让浏览器选择)。如何将侧边栏附加到菜单栏的底部 .fixed-left { position: fixed; left: 0; z-index: 0; .... (how to set it fixed to the bottom of the menubar?) } 谢谢 在中修改一些
.fixed-left {
position: fixed;
left: 0;
z-index: 0;
.... (how to set it fixed to the bottom of the menubar?)
}
谢谢 在
中修改一些css。修复了左侧
.fixed-left {
position: fixed;
top: 0; // set it equal as the height of fixed-top
bottom: 0; // so that it will stick to bottom
left: 0;
z-index: 0;
overflow-y: auto; // it will have the scroll if it has more content
width: 250px; // set as per your requirement
}
尝试将top:0
和bottom:0
添加到。修复了左侧的问题
谢谢-但是上面示例中的“搜索框”将移动到菜单栏下方。如何避免这种情况?@Defarine您可以将边距顶部添加到搜索框
,也可以将边距顶部
添加到固定左侧
。解决方案可能会根据您的标记和要求而有所不同。
.fixed-left {
position: fixed;
top: 0; // set it equal as the height of fixed-top
bottom: 0; // so that it will stick to bottom
left: 0;
z-index: 0;
overflow-y: auto; // it will have the scroll if it has more content
width: 250px; // set as per your requirement
}