In previous versions of Bootstrap it was a one-step process to localize it to a container element. This would allow you to use Bootstrap within the WordPress admin and not affect the rest of the built-in WordPress styles.

After version 3 of Bootstrap this method no longer works as Bootstrap started using more descendant selectors that do not translate properly when just wrapped in a container.  Fortunately, the workaround is fairly simple.  First, with this method we need to use the output CSS from Bootstrap rather than the LESS files.  Then, when importing it we pass the (less) option to force our LESS file to process the imported CSS as though it were also LESS.  This generates the correct class names to constrain your Bootstrap styles to a designated element without affecting the rest of the page.

Comments are closed.