Change Bootstrap input focus blue glow
To remove Bootstrap's blue glow on input focus, simply use box-shadow: none;
. Alternatively, you can apply a custom color using box-shadow: 0 0 0 0.2rem rgba(YourColor, Alpha);
.
Ensure these styles are applied after the bootstrap.css in the stylesheet link order, giving them priority style-wise.
Detailed styling guide
When changing the input focus style, ensuring visual consistency across your application should be your first commandment. Focus states, after all, are not just for the looks - they serve as guides for accessibility.
Harmonizing visual style
Focus styles in Bootstrap cover <input>
, <textarea>
, and <select>
elements. Changing such styles should therefore be done collectively across all elements:
Limiting scope of style
Apply your styles to specific elements or classes to prevent a Midas touch scenario—turning everything to gold when you just wanted the touch on your button!
The Sass advantage
With Bootstrap Sass, you can modify the _variables.scss
or create a custom @mixin
for a more adaptable solution. For Bootstrap 4 and 5, you can just do a quick change to the Sass variables and you're good to go:
Your Sass files will need to be compiled before the CSS is served.
Advanced customization guide
The aim of customizing should always be to enhance the user experience. Be mindful of accessibility issues, browser compatibility, meaningful colour usage, and create dynamic interactions.
Was this article helpful?