Ask any question about Bootstrap here... and get an instant response.
Post this Question & Answer:
How can I customize Bootstrap's default button styles using Sass variables?
Asked on Mar 31, 2026
Answer
To customize Bootstrap's default button styles using Sass variables, you need to override the default variables before importing Bootstrap's Sass files. This allows you to change button colors, padding, border radius, and more.
<!-- BEGIN COPY / PASTE -->
// Custom Bootstrap variables
$btn-primary-bg: #5a6268;
$btn-primary-border: #4e555b;
$btn-primary-color: #ffffff;
// Import Bootstrap
@import 'bootstrap';
<!-- END COPY / PASTE -->Additional Comment:
✅ Answered with Bootstrap 5 best practices.- Ensure you have Sass set up in your project to compile the styles.
- Place the custom variable overrides in a file before importing Bootstrap's main Sass file.
- You can customize other button variables like `$btn-padding-y`, `$btn-padding-x`, and `$btn-border-radius` similarly.
- This approach allows you to maintain Bootstrap's responsive and utility classes while customizing specific components.
Recommended Links:
