Many beginners directly edit Bootstrap’s CSS file to change styles. This is a bad practice because any update to Bootstrap will overwrite those changes.
The correct way to customize Bootstrap depends on how it is installed:
If using CDN:
Create a separate custom.css file and include it after the Bootstrap CSS link. Your styles will override Bootstrap because of CSS cascade rules.
Example:
<link href="bootstrap.min.css" rel="stylesheet">
<link href="custom.css" rel="stylesheet">
If using NPM + Sass (recommended method):
Override Bootstrap variables before importing the framework.
Example:
$primary: #5a2dff;
$border-radius: 1rem;
@import "bootstrap";
This method is cleaner and more scalable.
Important concepts involved:
Why this matters:
Professional projects never modify Bootstrap core files directly.