How can I override Bootstrap CSS styles?

前端 未结 12 1083
囚心锁ツ
囚心锁ツ 2020-11-22 05:35

I need to modify bootstrap.css to fit my website. I feel it\'s better to create a separate custom.css file instead of modifying bootstrap.css

12条回答
  •  不思量自难忘°
    2020-11-22 06:26

    It should not effect the load time much since you are overriding parts of the base stylesheet.

    Here are some best practices I personally follow:

    1. Always load custom CSS after the base CSS file (not responsive).
    2. Avoid using !important if possible. That can override some important styles from the base CSS files.
    3. Always load bootstrap-responsive.css after custom.css if you don't want to lose media queries. - MUST FOLLOW
    4. Prefer modifying required properties (not all).

提交回复
热议问题