I am having trouble using Bootstrap 4.0.0 utility classes regarding borders.
To be precise, I am encountering some (in my opinion) weird behaviour when applying class="border-primary border-bottom" on an element. When I check out DevTools in Chrome, I see the following output:
.border-primary { // This overrides color assigned from .border-bottom
border-color: #007bff!important;
}
.border-bottom {
border-bottom: 1px solid #dee2e6!important;
}
The .border-primary acts as if its color declaration overrides .border-bottom color declaration... Why does this happen when the class .border-primary is set before the class .border-bottom? Shouldn't the latter one override the previous one? They both have the !important tag and the same specificity (as far as my knowledge goes). The only thing that smells funny is the way we set the border color for .border-primary, it seems a little bit more explicit than for .border-bottom class.
Similar problem with borders happens when applying class="border-0 border-bottom" on an element.
When consulting DevTools , it looks like this:
.border-0 {
border: 0!important;
}
.border-bottom {
border-bottom: 1px solid #dee2e6!important; // This is clearly overridden by border-0
}
Basically, instead of denying all borders with .border-0 and then applying border on the bottom by .border-bottom, .border-0 seems to override all and remove all borders despite the fact .border-bottom is applied after .border-0 . This kind of opposes the way I thought CSS works.
If I apply class="border-0 border-primary border-bottom" .border-0 overrides .border-bottom, and .border-primary sets the color to primary,which means nothing,since there are no borders because of .border-0. Why does all this happen ? Is it a CSS thing, a Bootstrap 4.0.0 thing, or something else ? Please help
I am attaching a JSFiddle example below.