如何在没有容器流体的情况下解决导航栏碰撞?

时间:2019-07-31 03:02:09

标签: php bootstrap-4

我从Bootstrap文档中获取了我现有的代码,并将其崩溃,同时我将相同的代码放入Test.html中,并且可以正常工作。我尝试下载最新版本,将所有bootstrap.min.css和所有内容都放上了,但是它不起作用,试图将container-fluid放在第18行,但是问题仍然存在

我从Bootstrap文档(NavBars)中获取了代码。

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">    
    <title>Portal</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/estilos.css">
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Dropdown
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="#">Something else here</a>
        </div>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

还有我的login.php代码(冲突时)

<?php require 'inc/cabecera.inc'; ?>

<div class="container-fluid">
  <div class="row">
    <div class="col-md-12 text-center">
      <h1>Portal web</h1>
    </div>
  </div>

  <div class="row">

    <div class="col-sm-4 caja col-centrar">

      <form action="login.php" method="POST" role="form">
        <legend>Logueate!</legend>

        <div class="form-group">
          <input name="email" type="text" class="form-control" id="" placeholder="Su email...">
        </div>

        <div class="form-group">
          <input name="contrasena" type="password" class="form-control" id="" placeholder="Su contraseña...">
        </div>

        <button type="submit" class="btn btn-primary">Ingresar</button> &nbsp;&nbsp;
        <a class="pull-right" href="registrarse.php">Registrarse</a>
        <label for="" class="checkbox-inline">
            <input name="recordar" type="checkbox" value="activo"> Mantener sesión iniciada.
          </label>
      </form>
    </div>
  </div>
</div>

<?php require 'inc/footer.inc'; ?>

问题:

一切都很好:

0 个答案:

没有答案