Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html bootstrap4导航条项目延伸过去_Html_Django Bootstrap4 - Fatal编程技术网

Html bootstrap4导航条项目延伸过去

Html bootstrap4导航条项目延伸过去,html,django-bootstrap4,Html,Django Bootstrap4,使用bootstrap4时,顶部导航栏可以正常显示,但当我减小屏幕大小时,搜索栏就会延伸过去 Navigation.html {% load static %} <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <a href="#" class="navbar-brand"><img src="{% static "polls/images/background.gif" %}"&g

使用bootstrap4时,顶部导航栏可以正常显示,但当我减小屏幕大小时,搜索栏就会延伸过去

Navigation.html

{% load static %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <a href="#" class="navbar-brand"><img src="{% static "polls/images/background.gif" %}"> Lorem Ipsum</a>
        <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarMenu">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a href="#" class="nav-link">User</a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link">Products</a>
                </li>
            </ul>
        </div>        
    </nav>
Base.html

    {% load static %}

    <!DOCTYPE html>

    <html lang="en">
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

      <title>The HTML5 Herald</title>
      <meta name="description" content="The HTML5 Herald">
      <meta name="author" content="SitePoint">
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src='https://kit.fontawesome.com/a076d05399.js'></script>

  <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}">

      <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}">
    </head>

    <body>

        {% block navblock %}
        {% include "polls\navigation.html" %}
        {% endblock %}

        {% block content %}
        <div class="jumbotron jumbotron-fluid">
            <div class="container">
                <h1 class="display-4">Fluid jumbotron</h1>
            <p class="lead">This is a modified jumbotron that occupies the entire horizontal space of its parent.</p>
            </div>
        </div>
        {% endblock %}

        {% block footer %}
        {% include "polls\footer.html" %}
        {% endblock %}

        <div class="container my-4">

                <p class="font-weight-bold">Bootstrap cookie consent is a simple, not-invasive popup which displays information about cookies and privacy policy.</p>

                <p><strong>Detailed documentation and more examples you can find in our <a href="https://mdbootstrap.com/docs/jquery/modals/basic/"
                                                                                           target="_blank">Bootstrap Modals Docs</a> </p>

                <hr>

                <p class="font-weight-bold">Basic example</p>

              <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalCookie1">Launch modal</button>

                  <!--Modal: modalCookie-->
                  <div class="modal fade top" id="modalCookie1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                    aria-hidden="true" data-backdrop="true">
                    <div class="modal-dialog modal-frame modal-top modal-notify modal-info" role="document">
                      <!--Content-->
                      <div class="modal-content">
                        <!--Body-->
                        <div class="modal-body">
                          <div class="row d-flex justify-content-center align-items-center">

                            <p class="pt-3 pr-2">We use cookies to improve your website experience</p>

                            <a type="button" class="btn btn-primary">Learn more
                              <i class="fas fa-book ml-1"></i>
                            </a>
                            <a type="button" class="btn btn-outline-primary waves-effect" data-dismiss="modal">Ok, thanks</a>
                          </div>
                        </div>
                      </div>
                      <!--/.Content-->
                    </div>
                  </div>
                  <!--Modal: modalCookie-->
              </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>
使用bootstrap4修复侧导航需要做什么

我建议使用div.input-group,这可能会增强样式。检查引导输入组,了解该类的更多详细信息

 <div class="input-group">
    <input type="text" class="form-control" placeholder="Search this blog">
    <div class="input-group-append">
      <button class="btn btn-secondary" type="button">
        <i class="fa fa-search"></i>
      </button>
    </div>
  </div>

通过为引导提供自定义的非引导类,并在其达到导致问题的大小时在css中使用媒体查询,您始终可以解决引导问题。

很可能某些css属性会影响输入最小宽度,请尝试检查元素。您是否尝试在搜索控件上使用form control sm类?
    {% load static %}

    <!DOCTYPE html>

    <html lang="en">
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

      <title>The HTML5 Herald</title>
      <meta name="description" content="The HTML5 Herald">
      <meta name="author" content="SitePoint">
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src='https://kit.fontawesome.com/a076d05399.js'></script>

  <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}">

      <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}">
    </head>

    <body>

        {% block navblock %}
        {% include "polls\navigation.html" %}
        {% endblock %}

        {% block content %}
        <div class="jumbotron jumbotron-fluid">
            <div class="container">
                <h1 class="display-4">Fluid jumbotron</h1>
            <p class="lead">This is a modified jumbotron that occupies the entire horizontal space of its parent.</p>
            </div>
        </div>
        {% endblock %}

        {% block footer %}
        {% include "polls\footer.html" %}
        {% endblock %}

        <div class="container my-4">

                <p class="font-weight-bold">Bootstrap cookie consent is a simple, not-invasive popup which displays information about cookies and privacy policy.</p>

                <p><strong>Detailed documentation and more examples you can find in our <a href="https://mdbootstrap.com/docs/jquery/modals/basic/"
                                                                                           target="_blank">Bootstrap Modals Docs</a> </p>

                <hr>

                <p class="font-weight-bold">Basic example</p>

              <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalCookie1">Launch modal</button>

                  <!--Modal: modalCookie-->
                  <div class="modal fade top" id="modalCookie1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                    aria-hidden="true" data-backdrop="true">
                    <div class="modal-dialog modal-frame modal-top modal-notify modal-info" role="document">
                      <!--Content-->
                      <div class="modal-content">
                        <!--Body-->
                        <div class="modal-body">
                          <div class="row d-flex justify-content-center align-items-center">

                            <p class="pt-3 pr-2">We use cookies to improve your website experience</p>

                            <a type="button" class="btn btn-primary">Learn more
                              <i class="fas fa-book ml-1"></i>
                            </a>
                            <a type="button" class="btn btn-outline-primary waves-effect" data-dismiss="modal">Ok, thanks</a>
                          </div>
                        </div>
                      </div>
                      <!--/.Content-->
                    </div>
                  </div>
                  <!--Modal: modalCookie-->
              </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>
 <div class="input-group">
    <input type="text" class="form-control" placeholder="Search this blog">
    <div class="input-group-append">
      <button class="btn btn-secondary" type="button">
        <i class="fa fa-search"></i>
      </button>
    </div>
  </div>