Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4: Grid redux #19099

Merged
merged 34 commits into from
Feb 6, 2016
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5a9538d
Revamp grid classes to require .col base class and improve flexbox gr…
mdo Feb 6, 2016
a9e428a
Update grid docs to include new required .col base class
mdo Feb 6, 2016
3f30818
Fix docs layout with added base class
mdo Feb 6, 2016
511b959
Add flexbox grid page to the docs (still more content to add)
mdo Feb 6, 2016
9a645ef
Ensure docs grid example highlighting for flexbox mode
mdo Feb 6, 2016
e149a60
Update base class for grid cols in all examples
mdo Feb 6, 2016
cac9201
Merge branch 'v4-dev' into v4-grid-redux
mdo Feb 6, 2016
f50deda
Move grid flex classes to utils instead maybe?
mdo Jan 7, 2016
044716e
Conditionally include the flex utils in the import stack and reduce t…
mdo Feb 6, 2016
0de7321
rename .flex-all-* to .flex-items-* to match flexbox nomenclature
mdo Feb 6, 2016
7b7cf22
Move the conditional statement back to the file because nested import…
mdo Feb 6, 2016
9a519bb
Add vertical alignment docs for flexbox grid
mdo Feb 6, 2016
44bcaff
Tweak docs example CSS for flexbox grid cols
mdo Feb 6, 2016
82b98e7
more accurate comments
mdo Feb 6, 2016
5e41887
rename vertical align flex utils to middle to avoid clash with horizo…
mdo Feb 6, 2016
9e32140
add horizontal flex utils
mdo Feb 6, 2016
2a678d4
document horizontal flex utils, update the classes for the middle ver…
mdo Feb 6, 2016
94999c9
simpler, more specific docs example css
mdo Feb 6, 2016
414997b
flip things around again, no more base class, try out some new stuff …
mdo Feb 6, 2016
95f34be
More grid updates
mdo Feb 6, 2016
4ab7c93
property order
mdo Feb 6, 2016
50e854a
property order and white space
mdo Feb 6, 2016
15018a6
Ugh, Sass doesn't do extends across media, so we can't use placeholde…
mdo Feb 6, 2016
d043fe4
disable linter
mdo Feb 6, 2016
f127bc6
Merge branch 'v4-dev' into v4-grid-redux
mdo Feb 6, 2016
8d46a95
Merge branch 'v4-dev' into v4-grid-redux
mdo Feb 6, 2016
3743f27
linting
mdo Feb 6, 2016
414ae3a
use px in grid col padding since we're using px everywhere else for them
mdo Feb 6, 2016
7114e94
formatting
mdo Feb 6, 2016
bc45add
update grid vars docs
mdo Feb 6, 2016
fb4f5f0
document how to customize grid tiers
mdo Feb 6, 2016
ce81dd8
document migration for grid system /cc #17593
mdo Feb 6, 2016
844a180
mention media query changes
mdo Feb 6, 2016
fffaaed
Merge branch 'v4-dev' into v4-grid-redux
mdo Feb 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_data/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
pages:
- title: Overview
- title: Grid
- title: Flexbox grid
- title: Media object
- title: Responsive utilities

Expand Down
4 changes: 2 additions & 2 deletions docs/_layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

<div class="container">
<div class="row">
<div class="col-md-3 col-md-push-9 bd-sidebar">
<div class="col-md-3 push-md-9 bd-sidebar">
{% include nav-docs.html %}
</div>
<div class="col-md-9 col-md-pull-3 bd-content">
<div class="col-md-9 pull-md-3 bd-content">
<h1 class="bd-title" id="content">{{ page.title }}</h1>
{{ content }}
</div>
Expand Down
19 changes: 17 additions & 2 deletions docs/assets/scss/_component-examples.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,31 @@
//

.bd-example-row {
.row {
margin-bottom: 1rem;
.row + .row {
margin-top: 1rem;
}

.row {
> .col,
> [class^="col-"] {
padding-top: .75rem;
padding-bottom: .75rem;
background-color: rgba(86,61,124,.15);
border: 1px solid rgba(86,61,124,.2);
}
}

.flex-items-xs-top,
.flex-items-xs-middle,
.flex-items-xs-bottom {
min-height: 6rem;
background-color: rgba(255,0,0,.1);
}
}

.bd-example-row-flex-cols .row {
min-height: 10rem;
background-color: rgba(255,0,0,.1);
}


Expand Down
2 changes: 1 addition & 1 deletion docs/examples/blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ <h2 class="blog-post-title">New feature</h2>

</div><!-- /.blog-main -->

<div class="col-sm-3 col-sm-offset-1 blog-sidebar">
<div class="col-sm-3 offset-sm-1 blog-sidebar">
<div class="sidebar-module sidebar-module-inset">
<h4>About</h4>
<p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/carousel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ <h2 class="featurette-heading">First featurette heading. <span class="text-muted
<hr class="featurette-divider">

<div class="row featurette">
<div class="col-md-7 col-md-push-5">
<div class="col-md-7 push-md-5">
<h2 class="featurette-heading">Oh yeah, it's that good. <span class="text-muted">See for yourself.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
</div>
<div class="col-md-5 col-md-pull-7">
<div class="col-md-5 pull-md-7">
<img class="featurette-image img-fluid center-block" data-src="holder.js/500x500/auto" alt="Generic placeholder image">
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<li><a href="">Another nav item</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<div class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 main">
<h1 class="page-header">Dashboard</h1>

<div class="row placeholders">
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/grid/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ <h3>Offset, push, and pull resets</h3>
<p>Reset offsets, pushes, and pulls at specific breakpoints.</p>
<div class="row">
<div class="col-sm-5 col-md-6">.col-sm-5 .col-md-6</div>
<div class="col-sm-5 col-sm-offset-2 col-md-6 col-md-offset-0">.col-sm-5 .col-sm-offset-2 .col-md-6 .col-md-offset-0</div>
<div class="col-sm-5 offset-sm-2 col-md-6 offset-md-0">.col-sm-5 .col-sm-offset-2 .col-md-6 .col-md-offset-0</div>
</div>
<div class="row">
<div class="col-sm-6 col-md-5 col-lg-6">.col-sm-6 .col-md-5 .col-lg-6</div>
<div class="col-sm-6 col-md-5 col-md-offset-2 col-lg-6 col-lg-offset-0">.col-sm-6 .col-md-5 .col-md-offset-2 .col-lg-6 .col-lg-offset-0</div>
<div class="col-sm-6 col-md-5 offset-md-2 col-lg-6 offset-lg-0">.col-sm-6 .col-md-5 .col-md-offset-2 .col-lg-6 .col-lg-offset-0</div>
</div>


Expand Down
194 changes: 194 additions & 0 deletions docs/layout/flexbox-grid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
---
layout: docs
title: Flexbox grid system
group: layout
---

Fancy a more modern grid system? [Enable flexbox support in Bootstrap](/getting-started/flexbox) to take full advantage of CSS's Flexible Box module for even more control over your site's layout, alignment, and distribution of content.

Bootstrap's flexbox grid includes support for every feature from our [default grid system](/layout/grid), and then some. Please read the [default grid system docs](/layout/grid) before proceeding through this page. Features that are covered there are only summarized here. Please note that **Internet Explorer 9 does not support flexbox**, so proceed with caution when enabling it.

{% callout warning %}
**Heads up!** The flexbox grid documentation is only functional when flexbox support is explicitly enabled.
{% endcallout %}

## Contents

* Will be replaced with the ToC, excluding the "Contents" header
{:toc}

## How it works

The flexbox grid system behaves similar to our default grid system, but with a few notable differences:

- [Grid mixins](/layout/grid#sass-mixins) and [predefined classes](/layout/grid#predefined-classes) include support for flexbox. Just [enable flexbox support](/getting-started/flexbox) to utilize them as you would otherwise.
- Nesting, offsets, pushes, and pulls are all supported in the flexbox grid system.
- Flexbox grid columns without a set width will automatically layout with even widths. For example, four columns will each automatically be 25% wide.
- Flexbox grid columns have significantly more alignment options available, including vertical alignment.

Chill? Awesome—keep reading for more information and some code snippets.

## Auto-layout columns

As mentioned above, flexbox grid columns will automatically layout with even widths. Add any number of `.col-*`s for each breakpoint you need and you're good to go.

<div class="bd-example-row">
{% example html %}
<div class="container">
<div class="row">
<div class="col-xs">
One of two columns
</div>
<div class="col-xs">
One of two columns
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
</div>
</div>
{% endexample %}
</div>

Auto-layout for flexbox grid columns also means you can set the width of one column and the others will automatically resize around it. You may use predefined grid classes (as shown below), grid mixins, or inline widths.

<div class="bd-example-row">
{% example html %}
<div class="container">
<div class="row">
<div class="col-xs">
One of three columns
</div>
<div class="col-xs-6">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
</div>
</div>
{% endexample %}
</div>

## Vertical alignment

Use the flexbox alignment utilities to vertically align columns.

<div class="bd-example-row">
{% example html %}
<div class="container">
<div class="row flex-items-xs-top">
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
</div>
<div class="row flex-items-xs-middle">
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
</div>
<div class="row flex-items-xs-bottom">
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
<div class="col-xs">
One of three columns
</div>
</div>
</div>
{% endexample %}
</div>

<div class="bd-example-row bd-example-row-flex-cols">
{% example html %}
<div class="container">
<div class="row">
<div class="col-xs flex-xs-top">
One of three columns
</div>
<div class="col-xs flex-xs-middle">
One of three columns
</div>
<div class="col-xs flex-xs-bottom">
One of three columns
</div>
</div>
</div>
{% endexample %}
</div>

## Horizontal alignment

Flexbox utilities for horizontal alignment also exist for a number of layout options.

<div class="bd-example-row">
{% example html %}
<div class="container">
<div class="row flex-items-xs-left">
<div class="col-xs-4">
One of two columns
</div>
<div class="col-xs-4">
One of two columns
</div>
</div>
<div class="row flex-items-xs-center">
<div class="col-xs-4">
One of two columns
</div>
<div class="col-xs-4">
One of two columns
</div>
</div>
<div class="row flex-items-xs-right">
<div class="col-xs-4">
One of two columns
</div>
<div class="col-xs-4">
One of two columns
</div>
</div>
<div class="row flex-items-xs-around">
<div class="col-xs-4">
One of two columns
</div>
<div class="col-xs-4">
One of two columns
</div>
</div>
<div class="row flex-items-xs-between">
<div class="col-xs-4">
One of two columns
</div>
<div class="col-xs-4">
One of two columns
</div>
</div>
</div>
{% endexample %}
</div>
Loading