How do you override the default Bootstrap CSS?

  • Load your CSS after the Bootstrap CSS.
  • Change the CSS variables: for a button use --bs-btn-bg, --bs-btn-border-color, and for the page use --bs-body-font-family, --bs-border-radius.
  • If a rule does not win, make your selector a little more specific. Avoid !important when possible.
  • For a big change, use Sass variables.
  • Never edit the files in node_modules or the downloaded Bootstrap files.

See Bootstrap Customization.


Learn more about the similar topics:
Tutorials
Bootstrap Color Modes (Dark Mode)
Bootstrap Customization
Exercises & Assignments
Create a button which switches the page to dark mode
Interview Questions & Answers
How does dark mode work in Bootstrap 5.3?
How do you customize Bootstrap with Sass?
How do you override the default Bootstrap CSS?
What is RTL support in Bootstrap 5?
What are CSS variables in Bootstrap 5?