简体   繁体   中英

Boostrap 4 menu dropdown not showing completely using it in include

I made a menu with bootstrap and php. It works fine but when I use it with an include in another php the dropdown items are not seen. I don't know if I'm missing a div or should I use something else.

this is my menu.php code

<body>

 <nav class="navbar navbar-expand-sm bg-secondary navbar-dark sticky-top">
   <ul class="navbar-nav">
      <!-- Brand/logo -->
      <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">Administracion</a>
         <div class="dropdown-menu">
          <a class="dropdown-item" href="ajuste.php">Ajuste Cota</a>
          <a class="dropdown-item" href="estaciones.php">Estaciones</a>
          <a class="dropdown-item" href="panel.php">Panel de Control</a>
          <a class="dropdown-item" href="permisos.php">Permisos</a></div>
      </li>
      <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">Medicion</a>
         <div class="dropdown-menu">
           <a class="dropdown-item" href="">Puesto 1</a>
           <a class="dropdown-item" href="">Puesto 2</a>
           <a class="dropdown-item" href="">Puesto 3</a>
         </div>
      </li>
   </ul>
</nav>

</body>

and this is how I use this in another php file

<body>

 <?php include("menu.php");?>
<br>
<div class="container">
.
.
.
</body>

Someone can guide me how to fix this. Thanks

Too many <body> tags...you should only have one set ( <body>...</body> ) in your whole page. You don't need them in the menu file if that's going to be included in another file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM