Utilizing Bootstrap 4's Spacing Utilities, you can easily adjust margins and paddings through simple CSS classes.
In theory, it should be possible to achieve something like this:
<div class="d-inline-block bg-inverse p-5 pb-0 m-5 mb-0"></div>
This element should have paddings and margins on each side, with the exception of the bottom. Right?
However, instead of that happening, the pb-0
and mb-0
are being overridden by p-5
and
m-5</code, as illustrated in this example:
<a href="https://jsfiddle.net/80dssmxh/" rel="nofollow noreferrer">JSFiddle demo</a>.</p>
<hr>
<p>The <code>pb-0
and mb-0
classes come after p-5
and m-5
in the original source code, and all attributes in these classes have !important
. Therefore, pb-0
should override the padding-bottom
defined by p-5
, and mb-0
should override the margin-bottom
defined by m-5
.
I have created another example where I defined these classes in the same manner, and they work as intended: comparison demo in JSFiddle.