Disable Collapse bootstrap v4 Standard 5.5

Asked

Viewed 122 times

1

all right?

For this my doubt, I already found solution for bootstrap 3 but for 4 no.

I searched several pages, here in the stack, I tried to modify the css and nothing.

Anyone can help?

inserir a descrição da imagem aqui

1 answer

0


Your answer is in the documentation!

To navbars that never collapse, add the class .navbar-expand on the navigation bar. To navbars that always collapse, add no class .navbar-expand.

https://getbootstrap.com/docs/4.0/components/navbar/#Responsive-Behaviors

inserir a descrição da imagem aqui

Here’s an example working. This Navbar will always be "open" it will never collect the Links inside that button

<link rel="stylesheet" type="text/css" media="screen" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" />

<nav class="navbar navbar-expand navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav">
      <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>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </ul>
  </div>
</nav>

  • Hello friend, thank you. Upon seeing your reply, I went to see my code. It was like this: navbar-expand-lg. When removing the "-lg", it went all right. Thank you.

  • @Shbr that right there, this LG means that below screens Large he collapses the navbar :) [s

Browser other questions tagged

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