1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

Add .container-fluid variation for full-width containers and layouts

/cc #10711 #9862
This commit is contained in:
Mark Otto 2013-12-07 20:52:51 -08:00
parent 73bc7d9f12
commit 6273604601
6 changed files with 84 additions and 16 deletions

View file

@ -16,6 +16,7 @@
<li><a href="#grid-media-queries">Media queries</a></li>
<li><a href="#grid-options">Grid options</a></li>
<li><a href="#grid-example-basic">Ex: Stacked-to-horizonal</a></li>
<li><a href="#grid-example-fluid">Ex: Fluid container</a></li>
<li><a href="#grid-example-mixed">Ex: Mobile and desktops</a></li>
<li><a href="#grid-example-mixed-complete">Ex: Mobile, tablet, desktops</a></li>
<li><a href="#grid-responsive-resets">Responsive column resets</a></li>

View file

@ -76,7 +76,7 @@ base_url: "../"
<h3 id="grid-intro">Introduction</h3>
<p>Grid systems are used for creating page layouts through a series of rows and columns that house your content. Here's how the Bootstrap grid system works:</p>
<ul>
<li>Rows must be placed within a <code>.container</code> for proper alignment and padding.</li>
<li>Rows must be placed within a <code>.container</code> (fixed-width) or <code>.container-fluid</code> (full-width) for proper alignment and padding.</li>
<li>Use rows to create horizontal groups of columns.</li>
<li>Content should be placed within columns, and only columns may be immediate children of rows.</li>
<li>Predefined grid classes like <code>.row</code> and <code>.col-xs-4</code> are available for quickly making grid layouts. LESS mixins can also be used for more semantic layouts.</li>
@ -249,6 +249,16 @@ base_url: "../"
<div class="col-md-6">.col-md-6</div>
<div class="col-md-6">.col-md-6</div>
</div>
{% endhighlight %}
<h3 id="grid-example-fluid">Example: Fluid container</h3>
<p>Turn any fixed-width grid layout into a full-width layout by changing your outermost <code>.container</code> to <code>.container-fluid</code>.</p>
{% highlight html %}
<div class="container-fluid">
<div class="row">
...
</div>
</div>
{% endhighlight %}
<h3 id="grid-example-mixed">Example: Mobile and desktop</h3>

View file

@ -839,6 +839,33 @@ pre code {
}
}
.container-fluid {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.container-fluid:before,
.container-fluid:after {
display: table;
content: " ";
}
.container-fluid:after {
clear: both;
}
.container-fluid:before,
.container-fluid:after {
display: table;
content: " ";
}
.container-fluid:after {
clear: both;
}
.row {
margin-right: -15px;
margin-left: -15px;
@ -4467,14 +4494,18 @@ textarea.input-group-sm > .input-group-btn > .btn {
}
.container > .navbar-header,
.container > .navbar-collapse {
.container-fluid > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-collapse {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
.container > .navbar-header,
.container > .navbar-collapse {
.container-fluid > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-collapse {
margin-right: 0;
margin-left: 0;
}
@ -4530,7 +4561,8 @@ textarea.input-group-sm > .input-group-btn > .btn {
}
@media (min-width: 768px) {
.navbar > .container .navbar-brand {
.navbar > .container .navbar-brand,
.navbar > .container-fluid .navbar-brand {
margin-left: -15px;
}
}

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,11 @@
// Grid system
// --------------------------------------------------
// Set the container width, and override it for fixed navbars in media queries
// Container widths
//
// Set the container width, and override it for fixed navbars in media queries.
.container {
.container-fixed();
@ -17,12 +21,30 @@
}
}
// mobile first defaults
// Fluid container
//
// Utilizes the mixin meant for fixed width containers, but without any defined
// width for fluid, full width layouts.
.container-fluid {
.container-fixed();
}
// Row
//
// Rows contain and clear the floats of your columns.
.row {
.make-row();
}
// Columns
//
// Common styles for small and large grid columns
.make-grid-columns();
@ -76,4 +98,3 @@
.make-grid(@grid-columns, lg, push);
.make-grid(@grid-columns, lg, offset);
}

View file

@ -93,8 +93,10 @@
//
// When a container is present, change the behavior of the header and collapse.
.container > .navbar-header,
.container > .navbar-collapse {
.container,
.container-fluid {
> .navbar-header,
> .navbar-collapse {
margin-right: -@navbar-padding-horizontal;
margin-left: -@navbar-padding-horizontal;
@ -103,6 +105,7 @@
margin-left: 0;
}
}
}
//
@ -159,7 +162,8 @@
}
@media (min-width: @grid-float-breakpoint) {
.navbar > .container & {
.navbar > .container &,
.navbar > .container-fluid & {
margin-left: -@navbar-padding-horizontal;
}
}