删除默认填充后,bootstrap 4 container-fluid不是全宽

时间:2018-05-17 10:23:27

标签: css3 bootstrap-4

我想通过Bootstrap 4创建一个全宽度的网页。

我尝试移除容器液体的原始15px填充物,但它仍然无效。

有关jsfiddle的详细信息。我将整个背景标记为紫色,但你可以看到紫红色背景上没有完全覆盖jumbotron。

<style>
        .container-fluid {
            padding: 0 !important;
        }
    </style>

jsddle here

3 个答案:

答案 0 :(得分:2)

<div class="container-fluid px-0">
  <div class="row">
     <div class="col-12">
       your-content-goes-here
     </div>
   </div>
 </div>

https://getbootstrap.com/docs/4.1/utilities/spacing/#examples

答案 1 :(得分:1)

只需使用 col jumbotron 上的p-0m-0实用程序类(无需额外的CSS)...

<div class="container-fluid">
    <div class="row">
        <div class="col-md-12 p-0" style="background: purple;">
            <div class="jumbotron m-0">
                <h2>
                        Hello, world!
                    </h2>
                <p>
                    This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.
                </p>
                <p>
                    <a class="btn btn-primary btn-large" href="#">Learn more</a>
                </p>
            </div>
        </div>
    </div>
</div>

https://www.codeply.com/go/iAQiRARTFR

答案 2 :(得分:0)

从字面上键入:全宽容器对我有用。

<div  class="container-full-width">
<div  class=" row ">
    <div class="col-12">