It is recommended to utilize fluid-container
instead of container
as two of your columns
are exceeding the boundaries of the container
. However, in Bootstrap
, a column
cannot exceed its container.
If the fluid-container
is too wide, you can constrain its width using custom CSS.
.row div {
border: 1px solid #000;
}
.h-200px {
height: 200px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-6 mx-auto p-4 bg-dark">
</div>
</div>
<div class="row">
<div class="col-6 bg-success h-200px ">
</div>
<div class="col-3 offset-3 mr-auto ml-0 bg-primary h-200px ">
</div>
</div>
<div class="row">
<div class="col-6 mx-auto p-4 bg-dark">
</div>
</div>
<div class="row">
<div class="col-3 offset-3 ml-auto mr-0 bg-success h-200px ">
</div>
<div class="col-6 bg-primary h-200px ">
</div>
</div>
<div class="row">
<div class="col-6 mx-auto p-4 bg-dark">
</div>
</div>
</div>
https://i.sstatic.net/IYqzU.png
Explore this example on CodePen