twitter-bootstrap – 引导导航栏对齐想要对齐对齐

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap – 引导导航栏对齐想要对齐对齐前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试将导航栏对准。当我使用.pull-right类时,它会将导航栏向右推:太多了。

我究竟做错了什么?

码:

<div class="row">
<div class="span3 top_logo"><img src="images/logo_svart.png" width="177" height="60" alt="BETA Team Performance" /></div>
    <div class="span9">
        <div class="navbar navbar-static-top">
            <div class="navbar-inner">
                <div class="container">
                    <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><strong>MENY <i class="icon-chevron-down icon-white"></i></strong>
                    </button>
                    <div class="nav-collapse collapse">
                        <ul class="nav pull-right">
                            <li class="active"><a href="#">Start</a></li>
                            ...
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

解决方法

出现这个问题是因为在bootstrap-responsive.css中,margin-right设置为0。

Jsfiddle与基本样机See in browser

所以你必须提供一些数字来看,如下所示:

.navbar .nav.pull-right {
     float: right;
    margin-right: 98px; /*set margin this way in your custom styesheet*/
  }

创建您想要的效果HTML代码可以用以下方式写:

<div class="conatiner">
<div class="row-fluid">
    <div class="span2 top_logo">
        <img width="177" height="60" alt="BETA Team Performance" src="http://placehold.it/177x60">
    </div>
    <div class="span10">
        <div class="navbar navbar-static-top">
            <div class="navbar-inner">
                <div class="container">
                    <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
                    <button data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar"
                    type="button"><strong>MENY <i class="icon-chevron-down icon-white"></i></strong>

                    </button>
                    <!-- Everything you want hidden at 940px or less,place within here -->
                    <div class="nav-collapse collapse ">
                        <!-- .nav,.navbar-search,.navbar-form,etc -->
                        <ul class="nav pull-right">
                            <li class="active"><a href="#">Home</a>
                            </li>
                            <li><a href="#">Link</a>
                            </li>
                            <li><a href="#">Link</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
      </div>
    </div>
  </div>
原文链接:https://www.f2er.com/bootstrap/234185.html

猜你在找的Bootstrap相关文章