How to change Bootstrap navbar bg and text color? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to change Bootstrap navbar bg and text color?

currently using<nav class="navbar navbar-default"> bg change but not text color <nav class="navbar navbar-light bg-primary"> https://code.sololearn.com/W6QBWamm9gFf/?ref=app

10th Oct 2022, 2:28 AM
Mozzie
Mozzie - avatar
9 Answers
+ 2
This targets the text in your drop down menu and overrides the style. .navbar-default .navbar-nav>li>a { color: red !important; }
10th Oct 2022, 5:55 AM
Chris Coder
Chris Coder - avatar
+ 2
It doesnt change the font color.
10th Oct 2022, 4:32 AM
Mozzie
Mozzie - avatar
+ 2
You must specify the full path of the first and last container: .navbar .navbar-header a { color: orange; } Or <nav class='navbar text-primary'> Color: .text-primary .text-secondary .text-success .text-danger .text-warning .text-info .text-light .text-dark .text-muted .text-white
10th Oct 2022, 6:47 AM
Solo
Solo - avatar
+ 1
There are different ways to change the Bootstrap navbar background and text color, depending on the version of Bootstrap and the level of customization desired. Here are some possible options: - Use the built-in color classes for the navbar component, such as navbar-dark, navbar-light, or navbar-primary, to set the appropriate contrast and theme for the background and text color. For example, <nav class="navbar navbar-dark bg-primary"> will create a dark text on a primary blue background. See the documentation for more details: https://getbootstrap.com/docs/4.6/components/navbar/#color-schemes - Use custom CSS to override the default navbar styles and apply the desired color values to the navbar and its elements. For example, to change the navbar background to green and the text color to white, you could use something like: .navbar { background-color: green; } .navbar .navbar-brand, .navbar .navbar-nav .nav-link { color: white; } See the documentation for more details on the navbar structure and classes: https://getbootstrap.com/docs/4.6/components/navbar/#supported-content - Use Sass variables and mixins to customize the navbar colors and other aspects of the Bootstrap theme. This requires compiling the Sass files and importing the custom CSS
10th Oct 2022, 9:09 AM
Paul
0
Kim Jonas Cabugayan I just gave you example how you can override bootstrap css
10th Oct 2022, 6:11 AM
A͢J
A͢J - avatar
10th Oct 2022, 7:04 AM
Mozzie
Mozzie - avatar
0
Well that result is a lot different than what we thought you were asking about in your question...
10th Oct 2022, 7:13 AM
Chris Coder
Chris Coder - avatar
0
Chris Coder I'm trying to make the navbar-brand color danger(Kim Jonas Website) while the navbackground is transparent, then make it white when navbar bg appear.
10th Oct 2022, 7:19 AM
Mozzie
Mozzie - avatar
- 2
Just apply css to override bootstrap css .navbar { background-color:red; color:#fff; }
10th Oct 2022, 4:29 AM
A͢J
A͢J - avatar