Bootstrap从中间到右上角更改移动导航栏

时间:2014-12-10 06:30:56

标签: html css twitter-bootstrap twitter-bootstrap-2

我下载了一个bootstrap模板,其中间有一个下拉菜单(移动版)。

像这样: http://postimg.org/image/58hmpb8f5/

但我想在手机屏幕的右上角显示下拉菜单

像这样:http://postimg.org/image/5fkeraou1/

这是我到目前为止的html代码:

<header id ="top" class="mTop">
    <div class="topHead">
        <div class="container">
            <div class="row">
                <div class="topMenu">
                    <ul class="span12 topContact">
                        <li class="addresTop"><span class="icon-map-marker"></span>456 Jl.Pacar, Singapore</li>
                        <li class="mailTop"><span class="icon-envelope"></span>Office@Plasma.com</li>
                        <li class="phoneTop"><span class="icon-phone"></span>(+1) 321-9876520</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="headContent">
        <div class="container">
            <div class="row">
                <div class="span4">
                    <div class="brand">
                        <a href=""><img src="images/logo.png" alt="Logo"></a>
                    </div>
                </div>
                <div class="span8">
                    <div class="menu" id="steak">
                        <nav>
                            <ul class="navMenu inline-list" id="nav"> 
                                <li class="current"><a href="#top">Home</a></li>
                                <li><a href="#about">About</a></li>
                                <li><a href="#service">Service</a></li>
                                <li><a href="#team">Our Team</a></li>
                                <li><a href="#portfolio">Portfolio</a></li>
                                <li><a href="#blog">Blog</a></li>
                                <li><a href="#contact">Contact</a></li>
                            </ul>
                            <div class="clearfix"></div>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>

1 个答案:

答案 0 :(得分:1)

您不想使用最新的boostrap吗?最新的引导程序3.3.1具有您需要的导航。

bs3.3.1中的

代码是这样的

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <div>
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">Page 1</a></li>
        <li><a href="#">Page 2</a></li> 
        <li><a href="#">Page 3</a></li> 
      </ul>
    </div>
  </div>
</nav>

对于bootstrap 2,基本导航将在移动视图中有一个右上角的菜单

<div class="navbar">
  <div class="navbar-inner">
    <div class="container">

      <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>

      <!-- Be sure to leave the brand out there if you want it shown -->
      <a class="brand" href="#">Project name</a>

      <!-- Everything you want hidden at 940px or less, place within here -->
      <div class="nav-collapse collapse">
        <!-- .nav, .navbar-search, .navbar-form, etc -->
      </div>

    </div>
  </div>
</div>