diff options
author | Mark Otto <markdotto@gmail.com> | 2019-07-18 02:27:53 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2019-09-26 18:37:07 +0300 |
commit | 9ed860ef24a4a4103a779661364a28b5562eb2a7 (patch) | |
tree | 6582e89ec784c0336e274fcdd49565732e81e89d /site | |
parent | 28758a03f0602d4adc824fae756016d06343a00f (diff) |
First pass at .row-cols classes
Trying to find a new way to do responsive card decks while not locking ourselves into the cards themselves. My thinking here is we can easily control the column (.col) width by the parent, but I don't know how many we need (have 0-5 now) across each breakpoint. This works for cards so far, and I think could get us equal height, too.
Diffstat (limited to 'site')
-rw-r--r-- | site/docs/4.3/components/card.md | 88 | ||||
-rw-r--r-- | site/docs/4.3/layout/grid.md | 48 |
2 files changed, 136 insertions, 0 deletions
diff --git a/site/docs/4.3/components/card.md b/site/docs/4.3/components/card.md index fa9c6ffc15..7d04f45161 100644 --- a/site/docs/4.3/components/card.md +++ b/site/docs/4.3/components/card.md @@ -621,6 +621,94 @@ Just like with card groups, card footers in decks will automatically line up. {% endcapture %} {% include example.html content=example %} +### Grid cards + +Use the Bootstrap grid system and its [`.rol-cols` classes]() to control how many grid columns (wrapped around your cards) you show per row. + +{% capture example %} +<div class="row row-cols-2"> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p> + </div> + </div> + </div> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +{% capture example %} +<div class="row row-cols-3"> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p> + </div> + </div> + </div> + <div class="col"> + <div class="card mb-4"> + {% include icons/placeholder.svg width="100%" height="140" class="card-img-top" text="Image cap" %} + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> + </div> + </div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + ### Card columns Cards can be organized into [Masonry](https://masonry.desandro.com/)-like columns with just CSS by wrapping them in `.card-columns`. Cards are built with CSS `column` properties instead of flexbox for easier alignment. Cards are ordered from top to bottom and left to right. diff --git a/site/docs/4.3/layout/grid.md b/site/docs/4.3/layout/grid.md index f214841ccd..f03808044c 100644 --- a/site/docs/4.3/layout/grid.md +++ b/site/docs/4.3/layout/grid.md @@ -333,6 +333,54 @@ Here's an example of customizing the Bootstrap grid at the large (`lg`) breakpoi {% endcapture %} {% include example.html content=example %} +### Row columns + +Use the responsive `.row-cols-*` classes to quickly set the number of columns that best render your content and layout. Whereas normal `.col-*` classes apply to the individual columns (e.g., `.col-md-4`), the row columns classes are set on the parent `.row` as a shortcut. + +Use these row columns classes to quickly create basic grid layouts or to control your card layouts. + +<div class="bd-example-row"> +{% capture example %} +<div class="container"> + <div class="row row-cols-2"> + <div class="col">Column</div> + <div class="col">Column</div> + <div class="col">Column</div> + <div class="col">Column</div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} +</div> + +<div class="bd-example-row"> +{% capture example %} +<div class="container"> + <div class="row row-cols-3"> + <div class="col">Column</div> + <div class="col">Column</div> + <div class="col">Column</div> + <div class="col">Column</div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} +</div> + +<div class="bd-example-row"> +{% capture example %} +<div class="container"> + <div class="row row-cols-4"> + <div class="col">Column</div> + <div class="col">Column</div> + <div class="col">Column</div> + <div class="col">Column</div> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} +</div> + ## Alignment Use flexbox alignment utilities to vertically and horizontally align columns. **Internet Explorer 10-11 do not support vertical alignment of flex items when the flex container has a `min-height` as shown below.** [See Flexbugs #3 for more details.](https://github.com/philipwalton/flexbugs#flexbug-3) |