I have a collection of cards styled with Bootstrap and I am looking to add a left margin. I want the cards to be evenly spaced across the width. Right now, there is excess red on the right side that I want to remove...
.azer {
background: red;
}
.card-annuaire {
background: green;
border: 0;
border-radius: 0;
margin-right: 1rem;
}
.card-annuaire .card-body {
text-align: center;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="84e6ebebf0f7f0f6e5f4c4b1aab4aab6">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row justify-content-center my-5">
<div class="col-12">
<div class="qsdf">
<div class="azer">
<div class="col-md-12">
<div class="row g-0">
<div class="col-md-3 grid-item-annuaire letter-<?= $first_letter; ?>">
<div class="card card-annuaire mb-4">
<div class="card-body">
<div class="card-text entry-content"><img src="https://picsum.photos/100" />
</div>
<!-- /.card-text -->
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
<div class="col-md-3 grid-item-annuaire letter">
<div class="card card-annuaire mb-4">
<div class="card-body">
<div class="card-text entry-content"><img src="https://picsum.photos/100" alt="pic" />
</div>
<!-- /.card-text -->
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
<div class="col-md-3 grid-item-annuaire letter-<?= $first_letter; ?>">
<div class="card card-annuaire mb-4">
<div class="card-body">
<div class="card-text entry-content"><img src="https://picsum.photos/100" />
</div>
<!-- /.card-text -->
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
<div class="col-md-3 grid-item-annuaire letter-<?= $first_letter; ?>">
<div class="card card-annuaire mb-4">
<div class="card-body">
<div class="card-text entry-content"><img src="https://picsum.photos/100" />
</div>
<!-- /.card-text -->
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Check it out here: https://codepen.io/zazzou/pen/abYdZQL
EDIT Here's an example of what I want to achieve: (no margin on the left and right sides of the first and last card) https://i.sstatic.net/dKPjZ.jpg