【问题标题】:Horizontal aligning navbar elements on mobile - bootstrap 3在移动设备上水平对齐导航栏元素 - bootstrap 3
【发布时间】:2014-05-08 13:35:09
【问题描述】:

我想用以下元素序列显示响应式视图的导航栏

菜单(按钮)--BRAND(居中)--搜索(图标)--登录 (图标)

我尝试了很多方法来完成它,但没有成功。目前,在移动分辨率下,它们排成三排。

这是>中的代码bootply

对于桌面视图,元素按所需顺序对齐。

是否可以按照指定的顺序将它们全部对齐以用于移动视图?

【问题讨论】:

    标签: css twitter-bootstrap-3 navbar collapse


    【解决方案1】:

    使用这个:

    @media screen and (max-width: 768px) {
        .row {
            position: relative;
        }
    
        .navbar-header {
            left: 0;
            position: absolute;
            top: 0;
        }
    
        .navbar-brand {
            float: none;
            box-sizing: border-box;
            height: 50px;
            padding: 14px 50px;
            text-align: center;
            width: 100%;
        }
    
        .navbar-right {
            margin: 0;
            position: absolute;
            right: 0;
            top: 0;
        }
    
        .navbar-right > li {
            display: inline-block;
            margin-top: 4px;
        }
    }
    

    演示:http://www.bootply.com/125720

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-06
      • 1970-01-01
      • 1970-01-01
      • 2017-02-08
      • 2019-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多