Bootstrap menu does not work

Asked

Viewed 223 times

1

I’m developing a web application and I put it in the bootstrap menu link

Menu in normal page width

inserir a descrição da imagem aqui

but by decreasing the page width the menu does not look like this.

inserir a descrição da imagem aqui

Stay like this

inserir a descrição da imagem aqui

HTML

       <div class="body-wrap" >
   <div class="container" >
  <div id="menu">
  <nav id="navbar navbar-inverse" role="navigation" >
  <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" href="#"></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 class="active"><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>

CSS

    #menu {

            border-top: 1px solid black;
            border-bottom: 1px solid black;
            margin-top: 20px;
            background-color:#6495ED;
            text-align: center;
            padding: 10px !important;
            height: 40px;

        }


        .conteudo{
            display: inline;

        }

        a {
            padding: 10px !important;
            text-decoration: none;
            color: white;
        }

        li{

            display:inline;
            text-align: left;  
        }

1 answer

2


In the Nav tag you declared an id instead of a class, whenever you use the bootstrap you should use class. The right one would be:

<nav class="navbar navbar-inverse" role="navigation">

Browser other questions tagged

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