Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用css/html和“创建固定侧栏和固定菜单栏”;“浏览器选择的宽度/高度”;_Css_Bootstrap 4_Angular Ui Bootstrap - Fatal编程技术网

使用css/html和“创建固定侧栏和固定菜单栏”;“浏览器选择的宽度/高度”;

使用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?) } 谢谢 在中修改一些

我想创建一个固定的侧栏和菜单栏,以及一个内容页,如使用引导的示例所示:

对于菜单栏,我使用以下css(可以使用)

但是侧边栏应该使用什么css呢?因为我不知道菜单栏的高度(我不想显式设置它,但让浏览器选择)。如何将侧边栏附加到菜单栏的底部

.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
}