Django中的Bootstrap4无法正常工作

时间:2019-02-23 10:47:03

标签: html css django bootstrap-4

这是一张图片-> http://prntscr.com/mp0lj8 在那个世界图像之后,我有空白空间..我不知道这是什么问题。 任何Django用户都能告诉我我做错了吗

这是基本模板中的html代码,其中包含静态加载且其中包含{%块内容%}

{% load static %}
<!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="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="{% static 'seo_marketing/main.css' %}">>
    {% if title %}
    <title>Web Marketing Site - {{ title }}</title>
    {% else %}
    <title>Home Page</title>
    {% endif %}

</head>
<body id="body">

        <header class="site-header">
                <nav class="navbar navbar-expand-md navbar-light bg-steel fixed-top">
                  <div class="w-75 container-fluid">
                    <a class="logo nav-link" href="{% url 'index-page' %}">Web Marketing Services</a>
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggle" aria-controls="navbarToggle" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse" id="navbarToggle">
                      <div class="navbar-nav mr-auto">

                      </div>
                      <!-- Navbar Right Side -->
                      <div class="navbar-nav">
                          <a class="nav-item nav-link" style="color:#f3f3f3;" href="{% url 'index-page' %}">Home</a>
                          <a class="nav-item nav-link" style="color:#f3f3f3;"  href="#">About Us</a>
                          <a class="nav-item nav-link" style="color:#f3f3f3;"  href="#">Services</a>
                          <a class="nav-item nav-link" style="color:#f3f3f3;" href="#">Portfolio</a>
                          <a class="nav-item nav-link" style="color:#f3f3f3;" href="#">Blog</a>
                          <a class="nav-item nav-link" style="color:#f3f3f3;" href="#">Contact</a>
                      </div>
                    </div>
                  </div>
                </nav>
        </header>
    <div class="container-fluid">
        {% block content %}{% endblock  %}
    </div>
<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.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>

这是index_view,代表您在我发布的打印屏幕链接中看到的第一个首页

{% extends "seo_marketing/base.html" %}
{% block content %}
<div class="container-fluid wrapper">
  <div class="w-75 container-fluid">
  <div class="row">
    <div class="col-xs-12 col-sm-12 col-md-9 col-lg-9 col-xl-6">
      <h2 class="title">SERVING MOVING COMPANIES WITH MODERN SOLUTIONS IN THE ONLINE ENVIRONMENT</h2>
      <div class="row">
        <div class="col">
            <div class="card" style="width:350px">
                <img class="card-img-top" src="" alt="Card image">
                <div class="card-body">
                  <h5 class="card-title text-center">Search Engine Optimization</h5>
                  <h5 class="card-text text-center">(SEO)</h5>
                </div>
                <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
              </div> 
        </div>

        <div class="col">
            <div class="card" style="width:350px">
                <img class="card-img-top" src="" alt="Card image">
                <div class="card-body">
                  <h5 class="card-title text-center">Search Engine Optimization</h5>
                  <h5 class="card-text text-center">(SEO)</h5>
                </div>
                <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
              </div> 
        </div>

        <div class="col">
            <div class="card" style="width:350px">
                <img class="card-img-top" src="" alt="Card image">
                <div class="card-body">
                  <h5 class="card-title text-center">Search Engine Optimization</h5>
                  <h5 class="card-text text-center">(SEO)</h5>
                </div>
                <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
              </div> 
        </div>
        <div class="col">
            <div class="card" style="width:350px">
                <img class="card-img-top" src="" alt="Card image">
                <div class="card-body">
                  <h5 class="card-title text-center">Search Engine Optimization</h5>
                  <h5 class="card-text text-center">(SEO)</h5>
                </div>
                <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
              </div> 
        </div>
      </div>
    </div>


    <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 col-xl-6">
      <form class="form">
        <div class=" text-center">
          <h2 class="form-headline">Free Digital Marketing</h2>
        </div>
        <div class="row form-inside">
            <div class="col-xl-6">
                <div class="form-group">
                    <label for="exampleInputEmail1">Name</label>
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="Name" placeholder="Enter your name">
                </div>

                <div class="form-group">
                    <label for="exampleInputEmail1">Email address</label>
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
                    <!-- <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> -->
                </div>

                <div class="form-group">
                    <label for="phone">Your Website (URL)</label>
                    <input type="url" class="form-control" id="phone" placeholder="https://example.com" name="url">
                </div>

                <div class="form-group">
                    <label for="phone">Phone number</label>
                    <input type="tel" class="form-control" id="phone" placeholder="Enter phone number">
                </div>
              </form>
            </div>
            <div class="col-xl-1 vl"></div>
            <div class="col-xl-4 div-p">
                <p>&#10004;Your current Google rankings and market position</p>
                <p>&#10004;Insight into the technical performance and potential of your website</p>
                <p>&#10004;Your online footprint, including backlinks and company mentions</p>
                <p>&#10004;Review of your content quality and level of optimization</p>
                <small>*Done specifically for the moving industry</small>
            </div>

        <div class="text-center container">
             <button type="submit" class="btn btn-block button1"><h2 class="display-2 get-now">GET NOW</h2></button>
         </div>

    </div>
    </div>
  </div>

{% endblock content %}

CSS

body {
    background: #f5f2f2;

}
.wrapper {
    background: url('http://pavbca.com/walldb/original/5/2/e/48792.jpg');
    margin-top: 32px;
    padding: 100px;
}
.bg-steel {
    background-color: #073d3d;
}

.nav-link, .nav-item, a {
    color: white;
}

.title {
    font-weight: 400;
    font-size: 26px;
    color: #073d3d;
}

.form-headline {
    background: #073d3d;
    color: #ffffff;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    padding: 8px;
}
.form {
    border: 1px solid black;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.col {
   margin-top: 27px;
}

.form-inside {
    padding: 20px;
}

.vl {
    border-left: 1px solid gray;
    height: 350px;
    margin-left: 15px;

}

input {
    font-size: 15px;
}

.get-now {
    font-size: 25px;
    color: white;
    padding: 5px;
}
.button1 {
    background: #8E6719;
    margin-top: 15px;
} 

.button1:hover {
    background: #073d3d;
}

footer{
    background: #073d3d;
}
.copyright {
    background: #2e7070;
}

.container-fluid {
    padding-right:0;
    padding-left:0;
}

 .footer {
     color: white;
 }

 .div-p {
     color: rgb(53, 0, 0);
     font-size: 16px;
     margin-left: -20px;
 }

再次检查:https://prnt.sc/mp0lj8

在我创建页脚后,它进入了本节,这是我具有的形式。另外,当我创建另一个节或div时,它又进入了……也许我没有在某些地方输入div或类似的东西,但是我找不到它。谁能告诉我我做错了吗?

2 个答案:

答案 0 :(得分:0)

{% extends "seo_marketing/base.html" %} {% block content %}
<div class="container-fluid wrapper">
  <div class="w-75 container-fluid">
    <div class="row">
      <div class="col-xs-12 col-sm-12 col-md-9 col-lg-9 col-xl-6">
        <h2 class="title">SERVING MOVING COMPANIES WITH MODERN SOLUTIONS IN THE ONLINE ENVIRONMENT</h2>
        <div class="row">
          <div class="col">
            <div class="card" style="width:350px">
              <img class="card-img-top" src="" alt="Card image">
              <div class="card-body">
                <h5 class="card-title text-center">Search Engine Optimization</h5>
                <h5 class="card-text text-center">(SEO)</h5>
              </div>
              <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
            </div>
          </div>

          <div class="col">
            <div class="card" style="width:350px">
              <img class="card-img-top" src="" alt="Card image">
              <div class="card-body">
                <h5 class="card-title text-center">Search Engine Optimization</h5>
                <h5 class="card-text text-center">(SEO)</h5>
              </div>
              <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
            </div>
          </div>

          <div class="col">
            <div class="card" style="width:350px">
              <img class="card-img-top" src="" alt="Card image">
              <div class="card-body">
                <h5 class="card-title text-center">Search Engine Optimization</h5>
                <h5 class="card-text text-center">(SEO)</h5>
              </div>
              <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
            </div>
          </div>
          <div class="col">
            <div class="card" style="width:350px">
              <img class="card-img-top" src="" alt="Card image">
              <div class="card-body">
                <h5 class="card-title text-center">Search Engine Optimization</h5>
                <h5 class="card-text text-center">(SEO)</h5>
              </div>
              <a href="#" class="btn btn-dark  btn-lg btn-block">LEARN MORE</a>
            </div>
          </div>
        </div>
      </div>


      <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 col-xl-6">
        <form class="form">
          <div class=" text-center">
            <h2 class="form-headline">Free Digital Marketing</h2>
          </div>
          <div class="row form-inside">
            <div class="col-xl-6">
              <div class="form-group">
                <label for="exampleInputEmail1">Name</label>
                <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="Name" placeholder="Enter your name">
              </div>

              <div class="form-group">
                <label for="exampleInputEmail1">Email address</label>
                <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
                <!-- <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small> -->
              </div>

              <div class="form-group">
                <label for="phone">Your Website (URL)</label>
                <input type="url" class="form-control" id="phone" placeholder="https://example.com" name="url">
              </div>

              <div class="form-group">
                <label for="phone">Phone number</label>
                <input type="tel" class="form-control" id="phone" placeholder="Enter phone number">
              </div>

            </div>
            <div class="col-xl-1 vl"></div>
            <div class="col-xl-4 div-p">
              <p>&#10004;Your current Google rankings and market position</p>
              <p>&#10004;Insight into the technical performance and potential of your website</p>
              <p>&#10004;Your online footprint, including backlinks and company mentions</p>
              <p>&#10004;Review of your content quality and level of optimization</p>
              <small>*Done specifically for the moving industry</small>
            </div>
          </div>
          <div class="text-center container">
            <button type="submit" class="btn btn-block button1"><h2 class="display-2 get-now">GET NOW</h2></button>
          </div>
        </form>

      </div>
    </div>
  </div>
</div>
{% endblock content %}

答案 1 :(得分:0)

<footer class="container-fluid pt-4 footer">
        <div class="container text-center text-md-left">
          <div class="row">
            <div class="col-md-6 mt-md-0 mt-3">
              <h5 class="text-uppercase">Footer Content</h5>
              <p>Here you can use rows and columns here to organize your footer content.</p>

            </div>

            <hr class="clearfix w-100 d-md-none pb-3">
            <div class="col-md-3 mb-md-0 mb-3">

                <h5 class="text-uppercase">Links</h5>

                <ul class="list-unstyled">
                  <li>
                    <a href="#!">Link 1</a>
                  </li>
                  <li>
                    <a href="#!">Link 2</a>
                  </li>
                  <li>
                    <a href="#!">Link 3</a>
                  </li>
                  <li>
                    <a href="#!">Link 4</a>
                  </li>
                </ul>

              </div>

              <div class="col-md-3 mb-md-0 mb-3">
                <h5 class="text-uppercase">Links</h5>

                <ul class="list-unstyled">
                  <li>
                    <a href="#!">Link 1</a>
                  </li>
                  <li>
                    <a href="#!">Link 2</a>
                  </li>
                  <li>
                    <a href="#!">Link 3</a>
                  </li>
                  <li>
                    <a href="#!">Link 4</a>
                  </li>
                </ul>

              </div>


          </div>


        </div>

        <div class="container-fluid copyright text-center py-3">© 2019 Copyright:
          <a href="https://mdbootstrap.com/education/bootstrap/">Mare pusi karinu</a>
        </div>

      </footer>

我在

之后添加了该页脚
<div class="container-fluid">
        {% block content %}{% endblock  %}
</div>

在base.html中 立即检查-> http://prntscr.com/mp0ut7

我在index_view中复制了您发送给我的内容,但仍然相同。我正在搜索结束标签,因为我100%确定我错过了它。拉利找不到错误...