Ask any question about Bootstrap here... and get an instant response.
Post this Question & Answer:
How can I customize the default button styles in Bootstrap using Sass variables?
Asked on Apr 02, 2026
Answer
To customize the default button styles in Bootstrap using Sass variables, you need to override the default Bootstrap Sass variables before importing Bootstrap's Sass files. This allows you to apply your custom styles globally.
<!-- BEGIN COPY / PASTE -->
// Custom Bootstrap variables
$btn-primary-bg: #ff5733;
$btn-primary-border: #ff5733;
$btn-primary-color: #ffffff;
// Import Bootstrap
@import 'node_modules/bootstrap/scss/bootstrap';
<!-- END COPY / PASTE -->Additional Comment:
- First, ensure you have Bootstrap installed in your project, typically via npm or yarn.
- Create a custom Sass file (e.g., `custom.scss`).
- Override the default Bootstrap button variables in your custom Sass file.
- Import Bootstrap's Sass files after your custom variables to apply the changes.
- Compile your Sass file into CSS using a Sass compiler.
- The example changes the primary button's background, border, and text color.
- You can customize other button styles by overriding additional variables found in Bootstrap's `_variables.scss` file.
Recommended Links:
