Problems with a menu (navbar) in bootstap

0

I'm creating a bootstrap navbar. This is my navbar:

<!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
      <!-- Latest compiled and minified CSS -->
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
      <!-- Optional theme -->
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
      <!-- Latest compiled and minified JavaScript -->
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script></head>

    <body>
      <style>
         #brand-image
         {
         height: 30px;
         }
      </style>
      <!-- Fixed navbar -->
      <nav class="navbar navbar-default navbar-fixed-top">
         <div class="container">
            <div class="navbar-header">
               <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
               <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="http://www.marca.com">
                  <img id="brand-image" alt="Website Logo" src="free.png" />
            </div>
            <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
            <li><a href="#"><span class="glyphicon glyphicon-pencil">hola</span></a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
            <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
            <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li class="dropdown-header">Nav header</li>
            <li><a href="#">Separated link</a></li>
            <li><a href="#">One more separated link</a></li>
            </ul>
            </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
            <li><a href="">Default</a></li>
            <li><a href="">Static top</a></li>
            <li><a href="">Fixed top <span class="sr-only">(current)</span></a></li>
            </ul>
            </div><!--/.nav-collapse -->
         </div>
      </nav>
      <br>
      <br>
      <br>
      <br>
      <div class="container">
         <!-- Main component for a primary marketing message or call to action -->
         <div class="jumbotron">
            <h1>Navbar example</h1>
            <p>This example is a quick exercise to illustrate how the default, static and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
            <p>To see the difference between static and fixed top navbars, just scroll.</p>
            <p>
               <a class="btn btn-lg btn-primary" href="../../components/#navbar" role="button">View navbar docs &raquo;</a>
            </p>
         </div>
      </div>
      <!-- /container -->
      <!-- Bootstrap core JavaScript
         ================================================== -->
      <!-- Placed at the end of the document so the pages load faster -->
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
      <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
      <script src="../../dist/js/bootstrap.min.js"></script>
      <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
      <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
     </body>
</html>

But I have some problems, which are these and I am not able to solve them. I need

  • Reduce the distance between the "free" and the Home

  • Dropdown does not work: /

  • When I put an icon in front of the one section of the navbar, the format is changed. How can I avoid it?

  • How could you put an Active background and Active color like this:? :
  • I tried to put a padding to the right of the image but I did not get anything to reduce the distance. To avoid the change of style, I tried to put a button and the dropdown no idea.

    Let's see if you can help me. Greetings

        
    asked by Vidal 23.02.2018 в 16:04
    source

    2 answers

    0

    What you should do with respect to point number 1 is to add a margin left in -10px or whatever you want to put in the text ... since padding works for indoor and not for outdoor.

  • you should check that you have jquery spend both bootstrap and jquery abajjo. if it does not work

  • It changes to the format because you have it inside the text label. I'm not saying it does not work but you can try to put a different style directly from CSS.

  • you must put the active class to one of the list or be <li class="active">

  • answered by 23.02.2018 / 16:28
    source
    1

    First: You did not close the anchor <a></a>
    Second: "hello" must go outside of <span class="glyphicon"></span>
    Third: Check if the src of your libraries are correct


    Visit link
    link

        
    answered by 23.02.2018 в 19:31