bootstrap 5.3 how do you change the form field glow when clicking one? using scss?
Assistant
In Bootstrap 5.3, to customize the glow or focus state of a form field (like <input>, <textarea>, or <select>) when it's clicked/focused, you can override the default focus styles using SCSS.
Bootstrap uses .form-control for inputs and applies a box-shadow and border color on :focus state. Here's how you can change the focus glow effect using SCSS:
Steps
Identify the selector: For most inputs, it's .form-control:focus.
Override box-shadow and border color to customize the glow effect.
Use SCSS variables or direct CSS values to define your custom glow color.
Example SCSS to change the glow on focus
scss
// Define your custom glow color
$custom-glow-color: rgba(255, 0, 0, 0.25); // light red glow
.form-control:focus {
border-color: #ff0000; // red border on focus
box-shadow: 0 0 0 0.25rem $custom-glow-color; // red glow
outline: 0;
}
Explanation:
border-color changes the border to red on focus.
box-shadow creates a glow effect (a spread of a translucent red).
outline: 0; removes the default focus outline.
You can customize $custom-glow-color with any RGBA color to get the glow you want.
If you want to be more specific or use Bootstrap variables
Bootstrap uses some SCSS variables for focus state:
$form-focus-border-color
$form-focus-box-shadow (it's defined using the border color and an alpha)
You can override these variables in your own SCSS before importing Bootstrap’s form styles, or simply override the .form-control:focus styles afterward as shown above.
Full example with importing Bootstrap in SCSS
scss
// Your custom overrides BEFORE Bootstrap import
$form-focus-border-color: #ff0000;
$form-focus-box-shadow: 0 0 0 0.25rem rgba(255, 0, 0, 0.25);
@import "bootstrap"; // path to bootstrap.scss
This will globally change the focus color for all form controls.
Summary
Override .form-control:focus styles
Change border-color and box-shadow
Use SCSS variables for cleaner management
Optionally override Bootstrap variables before importing bootstrap SCSS
If you want me to provide a full minimal working example or help with a specific setup, just tell me!
User
when i click on a input it glows around it bluish, i want to change the color
Assistant
That blue glow you're seeing when clicking (focusing) an input is Bootstrap's default focus style, which typically uses a blue-ish box-shadow around the input.
To change the color of that glow, you should override the .form-control:focus styles, specifically the border-color and the box-shadow.
How to change the blue glow color on input focus in Bootstrap 5.3 using SCSS
Option 1: Override Bootstrap's variables before importing
Bootstrap 5 uses these SCSS variables to define the focus glow:
scss
$form-focus-border-color
$form-focus-box-shadow
You can override them to your custom color before importing Bootstrap.
Example:
scss
// custom.scss
// Set custom focus border and glow color to green
$form-focus-border-color: #28a745; // green border on focus
$form-focus-box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25); // green glow
// Then import Bootstrap
@import "bootstrap";
This changes the default focus glow color globally.
Option 2: Override after Bootstrap is loaded
If Bootstrap is already imported and you want to override locally or afterward:
The !important ensures your styles override Bootstrap's defaults.
Explanation
.form-control:focus controls the focus styles on inputs.
border-color changes the input border color.
box-shadow creates the glow — the 4 values represent: horizontal offset, vertical offset, blur radius, and spread radius, plus the color with transparency.
Let me know if you'd like me to help you integrate this with your build setup!
User
code
Assistant
Thanks for sharing your full SCSS setup! You already have a very thorough and solid Bootstrap SCSS import structure and custom theme variable overrides.
Your goal:
Change the blue glow on .form-control focus to a custom color by modifying the focus border color and shadow (glow).
Where to add this?
You have two main ways, but given your structure:
Since you import Bootstrap variables (including $form-focus-border-color and $form-focus-box-shadow) after your custom theme-color maps and variable definitions (step 4), the best way is to override these Bootstrap focus variables right before you import Bootstrap variables.
In your SCSS build, variables that come before @import "../../vendor/bower-asset/bootstrap/scss/variables"; can override Bootstrap's default variables.
What to do exactly:
Add the following after step 3 and BEFORE step 4.
In your SCSS, right before:
scss
// 4. Import Bootstrap variables and dark variables AFTER your manual definitions to allow any defaults to fill the rest (safe to import)
@import "../../vendor/bower-asset/bootstrap/scss/variables";
@import "../../vendor/bower-asset/bootstrap/scss/variables-dark";
add:
scss
// Customize the focus glow color:
// Pick one of your custom theme colors, e.g. "primary"
$form-focus-border-color: map-get($theme-colors, "primary") !default;
$form-focus-box-shadow: 0 0 0 0.25rem rgba(red(map-get($theme-colors, "primary")), green(map-get($theme-colors, "primary")), blue(map-get($theme-colors, "primary")), 0.25) !default;
Explanation:
$form-focus-border-color controls the border color on .form-control:focus
$form-focus-box-shadow controls the glow with the alpha transparency
User
"If you want me to help write the exact line numbers or edit your full file with this change, just ask!"
Yes, but also want to change the navbar dropdown menu click color and change it aswell as the color for whatever page your on in the navbar dropdown. they are both that primary blue color and i want them to be the new primy color i picked
Assistant
Got it! You want both:
Change the form input glow color on focus to your custom primary color (#0c7c94),
Change the navbar dropdown menu item active/focus colors and
Change the dropdown menu item highlight color of the current active page (i.e., the active dropdown item) in the navbar,
all to that same new primary (#0c7c94).
Your SCSS file context
You define $theme-colors in ~line 4-15.
You import Bootstrap variables ~line 180.
You import Bootstrap components after that.
Step 1: Change form input focus glow color (lines ~165-180)
Add this snippet between your theme color definitions and your Bootstrap variables import (~line 165):
scss
// CUSTOM FORM CONTROL FOCUS COLORS (sets the glow and border on focus)
$form-focus-border-color: map-get($theme-colors, "primary") !default;
$form-focus-box-shadow: 0 0 0 0.25rem rgba(
red(map-get($theme-colors, "primary")),
green(map-get($theme-colors, "primary")),
blue(map-get($theme-colors, "primary")),
0.25
) !default;
This overrides Bootstrap's $form-focus-border-color and $form-focus-box-shadow variables globally.
Step 2: Change Navbar Dropdown Menu item active / focus colors (after Bootstrap imports)
Bootstrap styles dropdown states via some classes and states:
.dropdown-menu .active or .dropdown-item.active — for active selected items.
.dropdown-item:focus, .dropdown-item:hover — for focus and hover states.
By default, Bootstrap sets these colors referencing $primary.
Because you already override $theme-colors ("primary": #0c7c94) earlier, Bootstrap's utilities and components using $theme-colors.primary will get your color automatically.
However, sometimes dropdown uses some hardcoded colors or different shades.
To make sure the dropdown active and focus states reflect your custom primary color, add this CSS (around line 230 or after):
User
just send me the complete code
Assistant
Certainly! Below is your full SCSS file including your original code plus the exact places and additions needed to:
Change the form input focus glow color to your custom primary #0c7c94.
Change the navbar dropdown menu active/focus/hover background and text colors.
Change the active navbar link text color.
The new code additions are clearly marked with // <<< CUSTOM OVERRIDE comments for your clarity.
scss
User
code
Assistant
The issue why the input glow is still the default blue is because your two repeated sets of variables (duplicated $form-focus-border-color and $form-focus-box-shadow) may cause confusion or override issues, and also importantly:
Bootstrap's variables are imported after your override, but some Bootstrap components may override these styles later or use a different variable.
Checklist to fix:
Remove duplicate $form-focus-border-color and $form-focus-box-shadow declarations — only define once, before you import Bootstrap variables.
Add !defaultonly if you want to allow overriding. Since you want to override, better to define without!default to ensure it overrides Bootstrap's default:
Final cleaned, minimal snippet for input glow override:
scss
User
send the full complete code
Assistant
Certainly! Here is your full SCSS file cleaned up and updated to:
Define only one set of $form-focus-border-color and $form-focus-box-shadow variables (without !default so they definitely override Bootstrap defaults),
Import Bootstrap variables after your overrides,
Import all Bootstrap components as before,
Finally, explicitly override the .form-control:focus style at the bottom to force your custom focus glow color and border with !important.
This will ensure your input focus glow color changes to your custom primary color #0c7c94 and the navbar dropdown and active nav link colors remain customized.
SCSS variables like $font-family-sans-serif exist only during SCSS compilation. They are not present in the compiled CSS, so you cannot use SCSS variables directly inside a regular CSS file like app.css.
To apply these fonts in your CSS:
You have two common approaches:
1) Use the variables in your SCSS files (recommended)
Use the variables in your SCSS where you style elements, e.g.:
Let me know if you want a full example SCSS file demonstrating font usage!
User
could i use root in my normal css delare them and use them as i please
Assistant
Yes! You can absolutely use CSS Custom Properties (CSS variables) defined on the :root selector in your regular CSS files and use them anywhere in your styles.
What you can do:
Instead of SCSS variables (which exist only during compile-time), define your fonts as CSS variables in your CSS like this:
SCSS variables are for build time; CSS variables are runtime.
You can define your fonts as CSS variables using :root.
Then use var(--variable-name) anywhere inside your CSS.
If you want, I can help you convert your SCSS variables to CSS custom properties or write a small example!
User
header nav.navbar a.navbar-brand
{
font-family: var(--heading-font-family);
font-size: 1.2rem;
}
header nav.navbar-nav a.nav-link
{
font-family: var(--main-font-family);
}
header nav.navbar-nav a.nav-link:visited
{
color: #212529;
}
whats the css for the page the user on?
Assistant
To style the navbar link that corresponds to the current/active page (the link of the page the user is currently on), you typically rely on an active class added to that link or its parent element.
Bootstrap (and most navs) use the .active class for this purpose.
CSS selector to target the active nav link:
css
header nav.navbar-nav a.nav-link.active {
/* Your styles for active/current page nav link */
font-weight: bold;
color: var(--main-font-color, #0c7c94); /* example active color */
/* any other styles */
}
Explanation:
Bootstrap adds .active by default to the link matching the current page.
You can style .nav-link.active to highlight the current page.
If your project uses a different way of marking active links, adjust accordingly.
If this works, then you have competing styles with higher specificity.
4) The link might be styled differently when visited or focused
User
does not work
Assistant
If your CSS selector for .nav-link.active is not taking effect, here’s a thorough debugging checklist and a working minimal example to ensure the active page link is styled correctly.
1. Verify markup has .active class on the current link
Your HTML must have something like this for the active page link:
/* Make active nav link bold and custom color */
#header-navbar-collapse .navbar-nav a.nav-link.active {
font-weight: 700;
color: #0c7c94 !important;
/* Optional: underline active link */
text-decoration: underline;
}
/* Optional: hover/focus style for active link */
#header-navbar-collapse .navbar-nav a.nav-link.active:hover,
#header-navbar-collapse .navbar-nav a.nav-link.active:focus {
color: darken(#0c7c94, 10%);
text-decoration: none;
}
Troubleshooting
If this still "does not work", try adding !important to each property, e.g.:
The <nav> element has classes: .navbar, .navbar-expand-md, .navbar-light, .fixed-top, but NOT .navbar-nav.
The .navbar-nav class is on the <ul>, not on the <nav>.
So your selector nav.navbar-nav literally looks for a <nav> with that class — but none in your markup has .navbar-nav.
Why it works when you use .navbar-nav on <ul> but not on <nav>?
In your markup, .navbar-nav is on <ul>.
So to target that, you need ul.navbar-nav or just .navbar-nav regardless of element (usually a <ul> in Bootstrap).
If you write nav.navbar-nav CSS selector, it won’t match anything, because the <nav> doesn’t have that class.
How to write the selector correctly based on your markup:
To target the nav container: nav#header-navbar
To target the nav list inside:
User
is it possible to bold a bootstrap icon
Assistant
Yes, it is possible to make a Bootstrap Icon appear bold, but since Bootstrap Icons are SVG-based (vector icons), you cannot just use the CSS font-weight property like with text.
How to make a Bootstrap Icon bold (or thicker):
1. Use a bolder icon variant if available
Bootstrap Icons release some icons in multiple weights (like regular, bold, etc.). Check if the icon you use has a bolder version, and switch to that SVG or class.
Bootstrap Icons themselves do not have font-weight variants by default, but some icons come in filled or outlined styles.
2. Increase the icon stroke-width or use a filled icon
Stroke icons can have thicker lines by applying CSS on the SVG or paths.
If the icon supports it, you can try:
css
.bi {
stroke-width: 2; /* or higher */
}
But not all icons respond to stroke-width because of how they are designed.
3. Use CSS filter or text-shadow tricks (less recommended)
You can fake boldness by adding shadows or duplicating the element, but this is hacky and may look bad.
4. Use font-based icon libraries that support font-weight (like Font Awesome Pro)
Bootstrap Icons are SVGs, so no font weight.
If you want easy "bold" control, you might prefer a font-based icon with weight variants.
Example: Increasing stroke width of an inline SVG icon
Bootstrap Icons often have outline and filled variants. For bold look, use a filled icon (usually bi-iconname-fill class) instead of outline bi-iconname.
rgba(red(...), green(...), blue(...), 0.25) builds the translucent glow color based on your theme primary color
!default means only set if not already set (safe to use here)
Because your $theme-colors map is defined before this, map-get works correctly.
Full snippet snippet showing context:
scss
// ... your variables definitions
$theme-colors: (
// ...
);
// Add your custom focus glow color here (before importing Bootstrap variables)
$form-focus-border-color: map-get($theme-colors, "primary") !default;
$form-focus-box-shadow: 0 0 0 0.25rem rgba(
red(map-get($theme-colors, "primary")),
green(map-get($theme-colors, "primary")),
blue(map-get($theme-colors, "primary")),
0.25
) !default;
// Now import Bootstrap variables which will pick up your override
@import "../../vendor/bower-asset/bootstrap/scss/variables";
@import "../../vendor/bower-asset/bootstrap/scss/variables-dark";
Result:
Now any .form-control when focused will have a border and glow based on your custom $theme-colors.primary (#0c7c94), instead of Bootstrap's default blue.
Optional: Pick other color
You can pick any color from your $theme-colors map:
Add those 2 variables after your theme colors defined but before importing Bootstrap variables.
Bootstrap variables uses those during internal compilation.
If for some reason you cannot do it before bootstrap variables import, or your setup is different, you can also override focus styles after bootstrap import:
But in your SCSS setup, I recommend the first method.
If you want me to help write the exact line numbers or edit your full file with this change, just ask!
after Bootstrap imports
scss
// NAVBAR DROPDOWN MENU ITEM ACTIVE & FOCUS COLORS OVERRIDE
.dropdown-menu .dropdown-item.active,
.dropdown-menu .dropdown-item:active,
.dropdown-menu .dropdown-item:focus,
.dropdown-menu .dropdown-item:hover {
color: #ffffff; /* white text (usually good contrast) */
background-color: map-get($theme-colors, "primary"); /* your custom primary background */
}
.navbar-nav .nav-link.active,
.navbar-nav .show > .nav-link {
color: map-get($theme-colors, "primary"); /* active navbar link text color */
}
Explanation:
.dropdown-item.active and friends get background of your custom primary color and white text.
.nav-link.active changes hamburger or nav link color/text color when the page is "active" (highlighting the current page nav link).
Summary of where to put what (based on your file):
scss
// ... after $theme-colors and all maps are defined (around line 165 - your variables section)
// Set form control focus glow color
$form-focus-border-color: map-get($theme-colors, "primary") !default;
$form-focus-box-shadow: 0 0 0 0.25rem rgba(
red(map-get($theme-colors, "primary")),
green(map-get($theme-colors, "primary")),
blue(map-get($theme-colors, "primary")),
0.25
) !default;
// 4. Import Bootstrap variables and dark variables AFTER your manual definitions to allow any defaults to fill the rest (safe to import)
@import "../../vendor/bower-asset/bootstrap/scss/variables";
@import "../../vendor/bower-asset/bootstrap/scss/variables-dark";
// ...
// (rest of bootstrap mixins and component imports)
// 7. After all Bootstrap imports, override dropdown active/focus colors (~line 230 or after last import)
.dropdown-menu .dropdown-item.active,
.dropdown-menu .dropdown-item:active,
.dropdown-menu .dropdown-item:focus,
.dropdown-menu .dropdown-item:hover {
color: #ffffff;
background-color: map-get($theme-colors, "primary");
}
.navbar-nav .nav-link.active,
.navbar-nav .show > .nav-link {
color: map-get($theme-colors, "primary");
}
Bonus: If you want smooth transition on dropdown items hover/focus/active
The $form-focus-border-color and $form-focus-box-shadow placed before variables import override Bootstrap's focus glow globally.
The dropdown .dropdown-item.active, :focus and :hover styles are overridden after imports to ensure your custom primary color (#0c7c94) is used for background and white text on hover/focus/active.
Active navbar link text color is set to your custom primary.
!important flags ensure these overrides apply definitively since Bootstrap may set some specificity.
If you compile this SCSS and your build loads the file correctly, your inputs will glow in your custom color and the dropdown menu active/hover states and navbar active links will also reflect your primary color.
If you want me to help with the compiled CSS confirmation or troubleshooting, just ask!
input field still loading the same blue, not the desired color that i want!
// Before bootstrap variables import:
$form-focus-border-color: map-get($theme-colors, "primary");
$form-focus-box-shadow: 0 0 0 0.25rem rgba(
red(map-get($theme-colors, "primary")),
green(map-get($theme-colors, "primary")),
blue(map-get($theme-colors, "primary")),
0.25
);
// Import bootstrap variables:
@import "../../vendor/bower-asset/bootstrap/scss/variables";
@import "../../vendor/bower-asset/bootstrap/scss/variables-dark";
// All other imports, mixins, components...
// After all imports add this explicit override if needed:
.form-control:focus {
border-color: map-get($theme-colors, "primary") !important;
box-shadow: 0 0 0 0.25rem rgba(
red(map-get($theme-colors, "primary")),
green(map-get($theme-colors, "primary")),
blue(map-get($theme-colors, "primary")),
0.25
) !important;
outline: none;
}
Why explicit .form-control:focus?
Sometimes Bootstrap assigns focus styles dynamically or your build might include other CSS that resets or adds more specificity, so overriding directly makes sure no other rules win.
Summary:
Remove duplicate variable declarations.
Define variables once before importing Bootstrap variables.
If variables alone don’t work, override .form-control:focus explicitly at the bottom with !important.
If you want I can send you the cleaned full SCSS file with the explicit fix I described — just ask!
Removed duplicates of $form-focus-border-color and $form-focus-box-shadow.
Defined these variables once before importing Bootstrap variables.
Added explicit .form-control:focus override to force the color with !important after all Bootstrap imports.
Custom dropdown item and navbar active link colors remain.
Compile your SCSS with this file, and your inputs' focus glow will change appropriately, plus the navbar dropdown active and hover states will use your custom primary color.
If you encounter any issues, please confirm your SCSS compilation process and caching (clear old CSS if needed). Let me know if you want help with that!
Sometimes :visited or other pseudo classes change color.