Nav-tabs is not visible in mobile

Asked

Viewed 86 times

0

On monitor, works normal, but in mobile the Nav disappears. To test and see if it was not some script that was missing in my code, I downloaded an example of bootstrap with all the links a css e js certinho, I inserted the same code, and it worked on the pc, but in mobile also disappeared. So clearly it’s no dependency, but why does Nav-tabs go mobile and how to fix it? Can someone help me, please?

<nav class="navbar navbar-expand-md navbar-light bg-light rounded">
    <div class="collapse navbar-collapse" id="navbarsExample09">
        <ul class="nav nav-tabs mr-auto">
            <li class="nav-item">
                <a class="nav-link active"  id="blog" href="#">Últimos Artigos</a>
            </li>
            <li class="nav-item">
                <a class="nav-link disabled" href="#">História</a>
            </li>
            <li class="nav-item">
                <a class="nav-link disabled" href="#">Geografia</a>
            </li>
            <li class="nav-item">
                <a class="nav-link disabled" href="#">Economia</a>
            </li>
            <li class="nav-item">
                <a class="nav-link disabled" id="videos" href="#">Vídeos</a>
            </li>            
        </ul>
        <form class="form-inline mt-2 mt-md-0">
            <input type="text" class="form-control mr-sm-2" id="search" placeholder="Pesquise um artigo...">
            <button class="btn btn-outline-secondary my-2 my-sm-0" type="submit">Procurar</button>
        </form>
    </div>
</nav>

2 answers

0

There is a little mistake there, see the example below, there is code missing, put the content inside the:
''

<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

</head>
<body>

<div class="bd-example">
  <nav id="navbar-exemplo2" class="navbar navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<ul class="nav nav-pills">
  <li class="nav-item">
    <a class="nav-link" href="#fat">@fat</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#mdo">@mdo</a>
  </li>
  <li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle active" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="#um">um</a>
      <a class="dropdown-item" href="#dois">dois</a>
      <div role="separator" class="dropdown-divider"></div>
      <a class="dropdown-item active" href="#tres">tres</a>
    </div>
  </li>
</ul>
  </nav>
  <div data-spy="scroll" data-target="#navbar-exemplo2" data-offset="0" class="scrollspy-example">
<h4 id="fat">@fat</h4>
<p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.</p>
<h4 id="mdo">@mdo</h4>
<p>Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.</p>
<h4 id="um">um</h4>
<p>Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.</p>
<h4 id="dois">dois</h4>
<p>In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.</p>
<h4 id="tres">três</h4>
<p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.</p>
<p>Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
</p>
  </div>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>

https://getbootstrap.com.br/docs/4.1/components/scrollspy/#list-item-2

has as it shows one at a time too

0


Lucas I think you gave a "traveled" in things. You put the Component of Navs, within the Navbar! There’s no way this is gonna work out...

See what you got Tabs within a Navbar

inserir a descrição da imagem aqui

See in the documentation that you have the Navs and the Navbar, are separate things!

inserir a descrição da imagem aqui

So if you want a Navbar these are the elements and the documentation https://getbootstrap.com/docs/4.3/components/navbar/#supported-content inserir a descrição da imagem aqui

In short

So you can’t use <div class="nav nav-tabs" id="nav-tab" role="tablist"> within a Navbar so it’s not working out there

  • 1

    That wasn’t even careless, man, I didn’t really know I would have this reaction in the mobile version, because insert the Nav in the navbar, the computer worked, the mobile he disappeared. Thanks for the help.

  • @Lucas then gets the hint there. Even save this link in your pages, it is very important to consult the documentation for this type of thing ;) Good studies

Browser other questions tagged

You are not signed in. Login or sign up in order to post.