Take a look at this example. I believe I should be able to manually set the width of card
elements using CSS. Despite my efforts, the width seems to be ignored and the final computed value is not what I expected. For instance, on larger screens, all 6 cards are displayed in a single row instead of following the specified width: 25%
. On smaller screens, the cards do not align side by side as intended.
<div class="container">
<div class="card-deck">
<div class="card mb-4">
<img class="card-img-top img-fluid" src="//placehold.it/500x280" alt="Card image cap">
<div class="card-body">
<h4 class="card-title">1 Card title</h4>
<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>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
[other card elements...]
</div>
.card {
width: 50%;
}
@media (min-width: 768px) {
.card {
width: 33%;
}
}
@media (min-width: 1200px) {
.card {
width: 25%;
}
}