Is it possible to mix card of different sizes within a card-group in Bootstrap 4. I want to have a large card (double width) on the left size, and two smaller cards on the right, with the same height of all three.
<div class="container">
<div class="row">
<div class="card-group">
<div class="card col-md-6">
<div class="card-block">
<h4 class="card-title">Card 1</h4>
<p class="card-text">Text 1</p>
</div>
</div>
<div class="card col-md-3">
<div class="card-block">
<h4 class="card-title">Card 2</h4>
<p class="card-text">Text 2</p>
<p class="card-text">More text 2</p>
<p class="card-text">More text 2</p>
</div>
</div>
<div class="card col-md-3">
<div class="card-block">
<h4 class="card-title">Card 3</h4>
<p class="card-text">Text 3</p>
</div>
</div>
</div>
</div>
</div>
I think the intention is that card groups are equal width and height(http://v4-alpha.getbootstrap.com/components/card/#groups), but you could override the default Bootstrap behavior to make it work like this..
.card-group [class*='col-'] {
float:none;
}
http://codeply.com/go/4WVwRBTyTP
Note: Wildcard CSS selectors like this are slow. It would be better to add a special CSS class to override the Bootstrap float:left
behavior of the columns in your card-group
UPDATE
Now that BS4 has flexbox, the extra CSS is no longer required. Just make the card-group
and row
the same div, and then use col-*
as normal to set width. However, using card-group
will prevent responsive column wrapping.
http://www.codeply.com/go/jzIcjyg6Xa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With