Bootstrap is great, but too opinionated. Selectors in its rules are very broad, like input or label.
Is there a way to sandbox Bootstrap’s CSS so that it only applies the rules to elements in a container with a certain class?
Right now we had to replace-regexp the CSS source to prepend .bootstrap to every selector. However, it might break Bootstrap’s modal windows and whatnot.
You could use a scoped style block that contains an
@importrule in it. You could even write a small JS to add this to every element that has your desired class.The tentative jQuery:
I realize
scopeisn’t very widely supported, so here’s a polyfill: https://github.com/thingsinjars/jQuery-Scoped-CSS-plugin