0

I'm trying to get full width container with jumbotron or something like this in full width:

<div class="container" style="margin: 0 auto;width: 100%;background-color: red">
  <div class="jumbotron">
    <h1>Full Width Layout</h1>

    <p class="lead">The Bootstrap 3 grid is fluid only. This example shows how to use a custom container to create a fixed width layout.</p>

    <p><a class="btn btn-large btn-success" href="http://bootply.com/tagged/bootstrap-3" target="ext">More
                    Examples</a>
    </p>
  </div>
</div>

currently i'm using : https://github.com/FezVrasta/bootstrap-material-design with Yii2.

I've tryied everything about this, but still the problem exist and it's not full width.

4

2 回答 2

2

要使 jumbotron 全宽且没有圆角,请将其放在所有 .containers 之外,然后在其中添加一个 .container。

<div class="jumbotron">
  <div class="container">
    ...
  </div>
</div>

查看文档

而且由于您使用的是 Bootstrap-Material,因此您可以使用内置类来添加颜色(这取决于material-fullpalette.css,而不是material.css,请参阅Docs

请参阅工作示例片段。

$.material.init()
/*ADD YOURSELF*/

.jumbotron.jumbo-red {
  background: red;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.4.4/css/material-fullpalette.min.css" rel="stylesheet" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.4.4/js/ripples.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.4.4/js/material.min.js"></script>

<div class="well">Your Own CSS for Color</div>
<div class="jumbotron jumbo-red">
  <div class="container">
    <h1>Full Width Layout</h1>

    <p class="lead">The Bootstrap 3 grid is fluid only. This example shows how to use a custom container to create a fixed width layout.</p>
    <p><a class="btn btn-large btn-success" href="#" target="ext">More
                Examples</a>

    </p>
  </div>
</div>
<hr>
<div class="well">Material CSS for Color</div>
<div class="jumbotron jumbotron-material-red-A700">
  <div class="container">
    <h1>Full Width Layout</h1>

    <p class="lead">The Bootstrap 3 grid is fluid only. This example shows how to use a custom container to create a fixed width layout.</p>
    <p><a class="btn btn-large btn-material-green" href="#" target="ext">More
                Examples</a>

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

于 2015-11-24T22:26:17.370 回答
2

如果你想要全宽

你不必container在你的页面中使用,并且记得从你正在使用的布局中删除这个类。(或者您可以在没有此类的情况下定义布局并 $this->layout= "yourNewLayout"; 在渲染页面之前在您的操作中设置)通常默认布局位于/view/layouts/main.php

那么你必须删除这一行:

 class="container" 

然后你可以看到一个完整的 yii2 web 应用程序。

只是一个未成年人

你应该使用:

  style="margin: 0 auto;width: 100%; background-color: red;">
于 2015-11-24T19:32:50.057 回答