In this scenario, I have two rows and two columns in each row. My goal is to make the yellow blocks take up all available space in the column while having a margin. However, currently the margin disrupts the alignment of the yellow content.
https://i.sstatic.net/RKX50.png
.row {
background: green;
}
.col {
background: red;
border: 1px solid blue;
height: 60px;
}
.content-margin {
margin: 10px;
background: yellow;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="34565b5b40474046554474011a061a07">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<div class="container">
<div class="row justify-content-md-center">
<div class="col col-lg-6">
<div class="content-margin w-100 h-100 d-flex"></div>
</div>
<div class="col col-lg-6">
<div class="content-margin w-100 h-100 d-flex"></div>
</div>
</div>
<div class="row justify-content-md-center">
<div class="col col-lg-6">
<div class="content-margin w-100 h-100 d-flex"></div>
</div>
<div class="col col-lg-6">
<div class="content-margin w-100 h-100 d-flex"></div>
</div>
</div>
</div>
The desired end result would look similar to this: https://i.sstatic.net/B4DDF.png
THE QUERY: Is it possible to achieve this by adding margin only to the yellow block?
NOTE: Although padding can be added to the COL itself as an alternative solution, it is not suitable for my actual use case.