How can I override Bootstrap CSS styles? | Bootstrap CSS basic | How to FrontEnd

preview_player
Показать описание
Among two selector styles browser will always choose the one with more weight. Order of your stylesheets only matters when priorities are even - that's why it is not easy to override Bootstrap.

Your option is to inspect Bootstrap sources, find out how exactly some specific style is defined, and copy that selector so your element has equal priority. But we kinda loose all Bootstrap sweetness in the process.

The easiest way to overcome this is to assign additional arbitrary ID to one of the root elements on your page, like this: body id="bootstrap-overrides"

This way, you can just prefix any CSS selector with your ID, instantly adding 100 points of weight to the element
Рекомендации по теме