I'm currently experimenting with offset and margins in Bootstrap 4, trying to achieve a layout similar to the image provided. Everything is working as expected except for the white spaces between the boxes. When I adjust the margins using mr-md-2, the blue box moves down instead of staying next to the yellow box like in the picture. How can I ensure consistent white spaces between all boxes at different screen sizes?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.css">
<style>
</style>
</head>
<body>
<div class="container-fluid">
<div class="row grid " >
<div class="col-xs-12 col-sm-6 col-md-4 mr-md-2 col-lg-3 offset-lg-3 " style="background-color:burlywood; height:200px;"></div>
<div class="col-xs-12 col-sm-6 col-md-4 ml-md-2 col-lg-3 " style="background-color:orange; height:200px;"></div>
</div>
<div class="row grid">
<div class="col-xs-12 col-sm-6 mt-md-2 mt-md-3 col-md-4 col-lg-6 " style="background-color:black;height:200px; "></div>
<div class="col-xs-12 col-sm-6 col-md-4 mt-md-2 offset-md-4 col-lg-3 offset-lg-3 " style="height:200px;background-color:red; "></div>
</div>
<div class="row grid">
<div class="col-xs-12 col-sm-6 col-md-4 mt-md-2 offset-md-4 col-lg-3 offset-lg-0 " style="background-color:yellow;height:200px; "></div>
<div class="col-xs-12 col-sm-6 col-md-4 mt-md-2 mr- col-lg-3 mr-lg-0 offset-lg-6 " style="background-color:blue; height:200px;"></div>
</div>
</div>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>