At this point in time, there are no Bootstrap classes specifically designed for the manipulation of the column-count
CSS property.
This limitation was identified on GitHub back in 2017, yet Bootstrap has not added any features to address this issue regarding the alignment of columns using classes.
However, a workaround exists without the need for CSS. Developers have been creating functionalities essential for Bootstrap's requirements.
For instance, specifying widths for various devices like this: w-sm-75
or w-md-50
is not possible within Bootstrap. The width
property can only be set as w-75
, w-100
, and so forth.
An external stylesheet CDN link complements Bootstrap by continually adding developer-requested features still under development.
This stylesheet enables setting widths for different devices as demonstrated here: w-sm-50 w-md-100 w-50
.
Additionally, it includes a column-count
property via the class car-col-2
.
In this context:
car
represents a card,
col
signifies the column count,
and 2
specifies the desired number of columns ranging from 1
to 6
.
By utilizing the car-col-2
CSS class, your layout will reflect these settings.
Important Note: This feature does not currently support multiple devices.
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous>
<!-- Stylesheet for card-columns-count and other developing features -->
<link rel="stylesheet" href="https://drive.google.com/uc?id=1jLrfISsLUcRiwgNl0koSfsS6lylj0E7h">
<div class="card-columns car-col-2">
<div class="card">
<p>This is a longer card with supporting text below as a natural lead-in to additional content. This content is slightly extensive.</p>
</div>
<div class="card">
<p>This is a longer card.</p>
</div>
<div class="card">
<p>This is a longer card with supporting text below as a natural lead-in to additional content. This content is slightly extensive.</p>
</div>
<div class="card">
<p>This is a longer card.</p>
</div>
<div class="card">
<p>This is a longer card.</p>
</div>
<div class="card">
<p>This is a longer card.</p>
</div>
<div class="card">
<p>This is a significantly long card. This is a significantly long card. This is a significantly long card. This is a significantly long card.</p>
</div>
<div class="card">
<p>This is a longer card.</p>
</div>
</div>
JSFIDDLE: https://jsfiddle.net/urqf0e61/