Change bootstrap menu according to page width

Asked

Viewed 957 times

0

I am developing a web application and put in my application the bootstrap menu would like when the application reaches the maximum width of max-width: 770px the menu is the same as the menu that is in the normal width of the page.

Menu in normal page width

UPDATE

inserir a descrição da imagem aqui

Menu in maximum width of 770px

inserir a descrição da imagem aqui

@media (max-width: 770px) {

body{

    background-color: yellow;
}


.navbar-header{
    display: none;
}

.nav .navbar-nav{

    display: inline;
}



 }
<div class="body-wrap" >

      <nav class="navbar navbar-inverse" role="navigation" id="azul">
      <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
        <a class="navbar-brand" ></a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
          <div class="conteudo"><li><a href="#">Pagina Principal</a></li></div> 
          <div class="conteudo"> <li><a href="#">Contato</a></li></div>
        <li class="dropdown">
            <div class="conteudo"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Produtos <b class="caret"></b></a></div>
          <ul class="dropdown-menu">
            <li><a href="#">Camisetas</a></li>
             <li class="divider"></li>
            <li><a href="#">Calças</a></li>
             <li class="divider"></li>
            <li><a href="#">Bermudas</a></li>
          </ul>
        </li>
      </ul>




    </div>
    <!-- /.navbar-collapse -->
  </div>
  <!-- /.container-fluid -->
</nav>



 </div>

1 answer

-1

You can take this treicho out of the code:

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
   <span class="sr-only">Toggle navigation</span>
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>
</button>

If you don’t want to use mobile, if you use, maintain and edit css:

@media screen and (max-width: 770px) {
    .navbar-header{
         ...
    }
}

Aconcelho take a look at this link where you can work with several types of @media.

  • and if I want to use mobile only at a resolution of 990px how do I do ? that’s my question

  • Jonathan updated the question and put my CSS, but still applying the @media screean max-width: 770px o . Nav . navbar-Nav did not appear

Browser other questions tagged

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