+ 1

Is it possible to costumize the color of navbar in bootstrap 4 using your own css?

Navbar bootstrap 4 color

2nd Apr 2020, 2:20 PM
JLouis
JLouis - avatar
5 Réponses
+ 2
JLouis , visph , Right but one thing that seems important, as far as I understood it,correct me if not, is that you need( in your head tags in html) to declare first the bootstrap link and then the link to your CSS stylesheet to allow specificity to apply according to cascading.(?)
2nd Apr 2020, 3:09 PM
EmmanueLZ.
EmmanueLZ. - avatar
+ 2
EmmanueLZ. Not exactly: for css, the order of linked file do not really matter... only in case of equal precedance rules, the later will override the sooner (so if you target to customize the framework, it's better practice to load the framework before your customized css, and obviously that's more logical and understandable for a code reader -- and wriiter necessarly)
2nd Apr 2020, 3:41 PM
visph
visph - avatar
+ 2
If you define a new color with a selector having more precedance than the color defined by the framework, it will override the value even if it's declared/loaded sooner: .yel { color:yellow; } div { color:cyan; } <div class='yel'></div> will have a yellow color applied, because class have more precedance than element (that's a basic example, often the selectors are more complex, impliying difficulty to see wich has precedance or how get more precedance than another rule -- and could leave some unexpected rules not applied even if after those we thinking ovveride)
2nd Apr 2020, 3:55 PM
visph
visph - avatar
+ 1
Sure: you could customize anything you can customize with only css by using any css framework... you just have to put css rules wich have more precedance than potentially already defined (customized) rules by the framework ^^
2nd Apr 2020, 2:37 PM
visph
visph - avatar
+ 1
visph , ok thanks, I thought it was his case as he wanted to customize the navbar color provided by bootstrap.
2nd Apr 2020, 3:46 PM
EmmanueLZ.
EmmanueLZ. - avatar