Bootstrap 4-如何设置导航栏项目的宽度(选择框)

时间:2018-11-21 15:59:05

标签: bootstrap-4

我想在导航栏上添加一个下拉列表,但不知道如何将其扩大。这是我实际拥有的:

  <nav class="navbar navbar-expand-lg navbar navbar-dark bg-dark">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
    <a class="navbar-brand" href="#">Hidden brand</a>
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
    </ul>
    <nav class="navbar-nav mx-auto">
      <select>
        <option value="volvo">Volvo</option>
        <option value="saab">Saab</option>
        <option value="mercedes">Mercedes</option>
        <option value="audi">Audi</option>
        <option value="looooong">VeeeeeeeryLooooongVeeehicle</option>
      </select>
    </nav>
    <ul class="navbar-nav">
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Dropdown
        </a>
        <div class="dropdown-menu ml-auto" aria-labelledby="navbarDropdownMenuLink">
          <a class="dropdown-item" href="#">Action-1</a>
          <a class="dropdown-item" href="#">Action-2</a>
          <a class="dropdown-item" href="#">Action-3</a>
        </div>
      </li>
    </ul>
  </div>
</nav>

有什么想法吗?谢谢。

0 个答案:

没有答案