BootStrap sets border-box on all elements by default:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
To override this, simply ensure your custom CSS file is referenced AFTER BootStrap in your site and set it back to the default content-box
:
* {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
*:before,
*:after {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
Check this fiddle out: https://jsfiddle.net/movs6gw0/1/
I added the BootStrap CSS file as a resource and if you inspect the content I've placed in the p
tags, you'll notice that BootStrap's border-box styling on *
(all) elements has been overriden by what I've placed above.
CSS is "Cascading", meaning whatever style you declare can be overriden by the same style declaration further down the CSS file / document. No need to use !important
unless absolutely crucial, in my opinion that goes against the philosophy of CSS.
Take the following example: https://jsfiddle.net/av4jbyt6/
<p>
Test content
</p>
CSS:
p {
color: white;
}
p {
color: red;
}
Both styles above reference the same element (p
), but the final style overrides the one before because it is further down the chain...