为什么元素永远不会到达我想要的地方?

时间:2018-02-27 10:18:47

标签: html css twitter-bootstrap

我试图使用bootstrap创建一个简单的导航栏,但一切似乎搞砸了。我已经尝试了好几个小时,而且事情并不合适。

我想要一个左侧和右侧的箭头跨度我想要一个搜索栏,一个带有图像的下拉菜单和一些用于制作时钟的文本..

任何人都可以检查我的代码没有这样做的原因吗?

像这样:http://prntscr.com/ikcdyx



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">


<nav id="top-menu" class="navbar bg-primary-gradient col-lg-12 col-12 p-0 fixed-top navbar-inverse d-flex flex-row">
  <div class="navbar-menu-wrapper d-flex align-items-center">
    <button id="menuToggler" class="navbar-toggler navbar-toggler hidden-md-down align-self-center mr-3" type="button" data-toggle="minimize">
            <span id="navbar-icon" class="fa fa-arrow-left">Arrow Icon</span>
        </button>
    <ul class="navbar-nav ml-lg-auto d-flex align-items-center flex-row">
      <li>
        <div class="search">
          <input type="text" class="form-control input-sm float-left" maxlength="64" placeholder="Search" />
          <button type="submit" class="btn btn-primary btn-sm"><span class="fa fa-search">Search Icon</span></button>
        </div>
      </li>
      <li>
        <div class="dropdown user-menu">
          <a class="dropdown-toggle topbar-user" id="navbar-user" data-toggle="dropdown">
            <img src="https://www.atomix.com.au/media/2015/06/atomix_user31.png" width="40" height="40" alt="" />
          </a>
          <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbar-user">
            <a class="dropdown-item" href="#"><span class="fa fa-user"></span> Profile</a>
            <a class="dropdown-item" href="settings"><span class="fa fa-cog"></span> Settings</a>
            <a class="dropdown-item" href="#"><span class="fa fa-question"></span> Help</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" onclick="logout()"><span class="fa fa-sign-out"></span> Sign out</a>
          </div>
        </div>
      </li>
      <li>
        <h5 id="clock">This will be the clock</h5>
      </li>
    </ul>
  </div>
</nav>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您正在使用引导程序3中不可用的类名。包括引导程序4,事情看起来已经更好了。希望这会有所帮助。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">



<nav id="top-menu" class="navbar bg-primary-gradient col-lg-12 col-12 p-0 fixed-top navbar-inverse d-flex flex-row">
  <div class="navbar-menu-wrapper d-flex align-items-center">
    <button id="menuToggler" class="navbar-toggler navbar-toggler hidden-md-down align-self-center mr-3" type="button" data-toggle="minimize">
            <span id="navbar-icon" class="fa fa-arrow-left">Arrow Icon</span>
        </button>
    <ul class="navbar-nav ml-lg-auto d-flex align-items-center flex-row">
      <li>
        <div class="search">
          <input type="text" class="form-control input-sm float-left" maxlength="64" placeholder="Search" />
          <button type="submit" class="btn btn-primary btn-sm"><span class="fa fa-search">Search Icon</span></button>
        </div>
      </li>
      <li>
        <div class="dropdown user-menu">
          <a class="dropdown-toggle topbar-user" id="navbar-user" data-toggle="dropdown">
            <img src="https://www.atomix.com.au/media/2015/06/atomix_user31.png" width="40" height="40" alt="" />
          </a>
          <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbar-user">
            <a class="dropdown-item" href="#"><span class="fa fa-user"></span> Profile</a>
            <a class="dropdown-item" href="settings"><span class="fa fa-cog"></span> Settings</a>
            <a class="dropdown-item" href="#"><span class="fa fa-question"></span> Help</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" onclick="logout()"><span class="fa fa-sign-out"></span> Sign out</a>
          </div>
        </div>
      </li>
      <li>
        <h5 id="clock">This will be the clock</h5>
      </li>
    </ul>
  </div>
</nav>