首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用css/html创建固定的侧边栏和固定的菜单栏,并带有“浏览器选择的宽度/高度”

问用css/html创建固定的侧边栏和固定的菜单栏,并带有“浏览器选择的宽度/高度”
EN

Stack Overflow用户
提问于 2020-02-14 21:45:35
回答 1查看 415关注 0票数 0

我想用bootstrap创建一个固定的侧边栏和固定的菜单栏,以及一个像这个例子一样的内容页面:

​

​

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

代码语言:javascript
复制
.fixed-top {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 0;
}

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

代码语言:javascript
复制
.fixed-left {
  position: fixed;
  left: 0;
  z-index: 0;
  .... (how to set it fixed to the bottom of the menubar?)
}

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2020-02-14 21:50:05

在.fixed-left中修改一些css

代码语言:javascript
复制
.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
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60227573

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档