Warm tip: This article is reproduced from stackoverflow.com, please click

Bootstrap 4 nav pills are not working

发布于 2020-03-30 21:16:07

     <!-- Bootstrap pills -->
                <ul class="nav nav-pills">
                    <li class="active">
                    <a data-toggle="pill" href="driver-details-tab">Driver Details</a>
                    </li>
                    <li>
                    <a data-toggle="pill" href="#erer">Register Driver</a>
                    </li>
                </ul>
<div class="tab-content">
          <div class="container-fluid drivers-main tab-pane active" id="driver-details-tab" role="tabpanel">
 <div class="tab-pane" id="register-driver-tab" role="tabpanel">
              asdsdd
          </div>
                      <div class="container-fluid drivers-main tab-pane active" id="erer" role="tabpanel">
 <div class="tab-pane" id="register-driver-tab" role="tabpanel">
ffffffffffffffffffffffffffff
          </div>
  </div>

Hello, I'm using nav-pills in bootstrap but for some reason it is not working properly, Please take a look at the code above, I haven't included bootstrap in the above fiddle

Questioner
Harish
Viewed
56
Klooven 2017-11-16 22:58

Use something like this for the pills:

<ul class="nav nav-pills">
  <li class="nav-item">
    <a class="nav-link active" data-toggle="pill" href="#driver-details-tab">Driver Details</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" data-toggle="pill" href="#erer">Register Driver</a>
  </li>
</ul>

Note the classes that I've added.