简体   繁体   English

Bootstrap:垂直导航栏可以响应地切换到水平吗?

[英]Bootstrap: Vertical navbar that responsively switches to horizontal?

I have a responsive Bootstrap 3 layout in progress. 我有一个正在响应的Bootstrap 3布局。 It has the following general shape: 它具有以下一般形状:

[Navigation, col-md-1][Sidebar, col-md-3][Content, col-md-8] [导航,col-md-1] [侧边栏,col-md-3] [内容,col-md-8]

My navigation is vertically stacked, like this: 我的导航垂直堆叠,如下所示:

[Nav 1] [导航1]

[Nav 2] [导航2]

[Nav 3] [导航3]

(Nav is a UL, each item is an LI.) (Nav是UL,每个项目都是LI。)

When I resize my design, as expected, the sidebar and content slide "under" the navigation. 当我按预期调整设计大小时,侧栏和内容会在导航下方“滑动”。 But my nav doesn't need to take up the same height when the design switches. 但是当设计切换时,我的导航不需要占据相同的高度。 What I'd like is for the Nav to switch to columns when I cross the responsive threshold. 我想要的是让Nav在超过响应阈值时切换到列。 That way it will take up less space. 这样,它将占用更少的空间。 Alternatively, I'd be happy for it to disappear completely. 另外,我很乐意它完全消失。

Any pointer? 有指针吗?

You might want to use Bootstrap's default nav if you want it to disappear and get replaced nicely. 如果您希望它消失并被很好地替换,则可能要使用Bootstrap的默认导航。

Otherwise, you should play around with different sized columns. 否则,您应该使用不同大小的列。 If you use col-xs-1 for the nav it won't switch to 100% width with smaller screen sizes. 如果您将col-xs-1用于导航,则在较小的屏幕尺寸下不会切换为100%宽度。

Alternatively, if you want it to disappear, you should check out: http://getbootstrap.com/css/#responsive-utilities 另外,如果您希望它消失,则应签出: http : //getbootstrap.com/css/#sensitive-utilities

Adding the .hidden-xs to the nav will make it disappear at smaller screen sizes. 将.hidden-xs添加到导航栏将使其在较小的屏幕尺寸下消失。

Some combination of these should solve your problem. 这些的某种组合应该可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM