Yes, absolutely! You can use Bootstrap and external CSS together, and it's actually very common to do so. Here's how it works and what you need to know:
How to Use Them Together
1. Load Order Matters
Always load Bootstrap CSS first, then your custom CSS file:
<!-- Use both Bootstrap and custom classes -->
<div class="card custom-card">
<div class="card-body">
<h5 class="card-title text-primary custom-title">Hello World</h5>
</div>
</div>
Best Practices
Use CSS Specificity Wisely
If Bootstrap styles aren't being overridden, increase specificity:
css
/* More specific selector */
.navbar .nav-link {
color: #ff6b6b;
}
/* Or use a parent class */
.my-app .btn-primary {
background-color: #ff6b6b;
}
Don't Fight the Framework
Instead of completely overriding Bootstrap components, extend them:
css
/* Good: Extend Bootstrap's button */
.btn-custom {
@extend .btn; /* If using Sass */
background-color: #ff6b6b;
text-transform: uppercase;
}
/* Or in plain CSS, use both classes */
/* <button class="btn btn-custom">Click Me</button> */
Use CSS Custom Properties (Variables)
Modern Bootstrap uses CSS variables that you can override:
css
:root {
--bs-primary: #ff6b6b; /* Changes primary color throughout */
--bs-font-sans-serif: 'Inter', sans-serif;
}
Common Use Cases
Theming: Use Bootstrap for structure, custom CSS for brand colors and fonts
Additional Components: Bootstrap doesn't have everything—add your own
Responsive Tweaks: Fine-tune Bootstrap's breakpoints for specific needs
Animations: Add custom transitions and animations Bootstrap doesn't provide
Potential Issues to Watch For
Specificity Conflicts: Sometimes you need !important (use sparingly)
Naming Collisions: Avoid naming your classes the same as Bootstrap's
File Size: You're loading Bootstrap + your CSS, which can be heavy
The key is to use Bootstrap as a foundation and enhance it with your custom styles rather than fighting against it. This approach gives you Bootstrap's tested components and grid system while maintaining the flexibility to create a unique design.