I have a component with the following markup to use the advantages of the Bootstrap grid.
<div class="row">
<div class="col-6">...</div>
<div class="col-6">...</div>
</div>
But I had someone raise the concern that this means the component's parent then needs to deal with the row
's negative margins. The component should be wrapped in a container
class to be a "complete" Bootstrap grid layout.
<div class="container">
<div class="row">
<div class="col-6">...</div>
<div class="col-6">...</div>
</div>
</div>
But, if I do this, the child component now has outer gutters, which are unnecessary to this small component and creates double gutters when combined with a parent's col
or container
and the child's container
.
Per this answer, Bootstrap doesn't trivially let you remove these outer gutters but preserve the inner gutters.
Is it possible to use Bootstrap in a component's styles without its parent having to know and deal with its child's padding choices?