Bootstrap problem

Asked

Viewed 182 times

0

I’m having trouble in index.html, but I don’t know how to fix it. It was for Mizuxe appear on the left but the opposite happens.

Already my items: Home; About; Meet; The; Authors and Contact disappear.

Man index.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="css/font-awesome.min.css">
  <link rel="stylesheet" href="css/bootstrap.css">
  <link rel="stylesheet" href="css/style.css">
  <title>Bootstrap 4 Starter</title>
</head>
<body id="home">
  <nav class="navbar navbar-toggleable-md navbar-light fixed-top py-4">
    <div class="container">
      <button class="navbar-toggler navbar-toggler-right"><span class="navbar-toggler-icon"></span></button>
      <a href="#" class="navbar-brand">
        <img src="img/mlogo.png" width="50" height="50" alt=""> 
        <h3 class="d-inline align-middle">Mizuxe</h3>
      </a>
      <div class="collapse navbar-collapse" id="navbarNav">
        <ul class="navbar-nav ml-auto">
          <li class="nav-item">
            <a href="#home" class="nav-link">Home</a>
          </li>
          <li class="nav-item">
            <a href="#about" class="nav-link">About</a>
          </li>
          <li class="nav-item">
            <a href="#authors" class="nav-link">Meet The Authors</a>
          </li>
          <li class="nav-item">
            <a href="#contact" class="nav-link">Contact</a>
          </li>
        </ul>
      </div>
    </div>
  </nav>

  <script src="js/jquery.min.js"></script>
  <script src="js/tether.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script src="js/navbar-fixed.js"></script>
</body>
</html>

To facilitate understanding, follows the wrong shape: Errado

and desired format: certo

1 answer

1

You need to put the soon before the button, and the class navbar-expand-lg on tab <nav>. In addition to including the attributes below in the menu button:

data-toggle="collapse" data-target="#navbarNav" aria-expanded="false" aria-label="Toggle navigation"

See working:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>

<nav class="navbar navbar-expand-lg navbar-toggleable-md navbar-light fixed-top py-4">
 <div class="container">
   <a href="#" class="navbar-brand">
     <img src="img/mlogo.png" width="50" height="50" alt=""> 
     <h3 class="d-inline align-middle">Mizuxe</h3>
   </a>
   <button class="navbar-toggler navbar-toggler-right" data-toggle="collapse" data-target="#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 ml-auto">
       <li class="nav-item">
         <a href="#home" class="nav-link">Home</a>
       </li>
       <li class="nav-item">
         <a href="#about" class="nav-link">About</a>
       </li>
       <li class="nav-item">
         <a href="#authors" class="nav-link">Meet The Authors</a>
       </li>
       <li class="nav-item">
         <a href="#contact" class="nav-link">Contact</a>
       </li>
     </ul>
   </div>
 </div>
</nav>

  • Solved. I thought it was the bootstrap.

  • @Apach3 Blz! If you found the answer helpful, check so you can help others with the same problem in the future. Abs!

Browser other questions tagged

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