Bootstrap 4 navbar color2019 Community Moderator ElectionBootstrap Change Navbar Link ColorsHow to make Bootstrap navbar transparentBootstrap 4 Navbar color won't changeHow to change color of the links in the Navbar (Bootstrap 4.1.0)?How to change hover text for bootstrap navbarI want to change the background-color of my Bootstrap navigation bar.How to change the navigation bar font and color of the text?How do I select navbar items for hover and active with Bootstrap CSS?Change navbar color in Twitter BootstrapBootstrap 4 Change Hamburger Toggler ColorChange navbar color in Twitter BootstrapBootstrap 4 Navbar align rightBootstrap 4 Alpha 6 navbar-toggler-right and left create strange behaviorHow to center navbar in Bootstrap 4 using Flexboxsafari issue - navbar brand pushes down toggleable navbarbootstrap4 nav not working properlyBootstrap 4 navbar not collapsing or expandingWhy is the toggle button of this Bootstrap navbar not working?Always expanded vertical bootstrap navbar for mobileBootstrap4.1 Navbar Vertical items instead of Horizontal Album Example
Possible Leak In Concrete
What are the possible solutions of the given equation?
Informing my boss about remarks from a nasty colleague
Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?
Good allowance savings plan?
Do I need life insurance if I can cover my own funeral costs?
How could a female member of a species produce eggs unto death?
Brexit - No Deal Rejection
Replacing Windows 7 security updates with anti-virus?
Bash: What does "masking return values" mean?
Ban on all campaign finance?
Why do Australian milk farmers need to protest supermarkets' milk price?
At what level can a dragon innately cast its spells?
Life insurance that covers only simultaneous/dual deaths
Unreachable code, but reachable with exception
Welcoming 2019 Pi day: How to draw the letter π?
When do we add an hyphen (-) to a complex adjective word?
Why would a flight no longer considered airworthy be redirected like this?
My adviser wants to be the first author
What has been your most complicated TikZ drawing?
Current sense amp + op-amp buffer + ADC: Measuring down to 0 with single supply
How is the Swiss post e-voting system supposed to work, and how was it wrong?
Why do passenger jet manufacturers design their planes with stall prevention systems?
Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?
Bootstrap 4 navbar color
2019 Community Moderator ElectionBootstrap Change Navbar Link ColorsHow to make Bootstrap navbar transparentBootstrap 4 Navbar color won't changeHow to change color of the links in the Navbar (Bootstrap 4.1.0)?How to change hover text for bootstrap navbarI want to change the background-color of my Bootstrap navigation bar.How to change the navigation bar font and color of the text?How do I select navbar items for hover and active with Bootstrap CSS?Change navbar color in Twitter BootstrapBootstrap 4 Change Hamburger Toggler ColorChange navbar color in Twitter BootstrapBootstrap 4 Navbar align rightBootstrap 4 Alpha 6 navbar-toggler-right and left create strange behaviorHow to center navbar in Bootstrap 4 using Flexboxsafari issue - navbar brand pushes down toggleable navbarbootstrap4 nav not working properlyBootstrap 4 navbar not collapsing or expandingWhy is the toggle button of this Bootstrap navbar not working?Always expanded vertical bootstrap navbar for mobileBootstrap4.1 Navbar Vertical items instead of Horizontal Album Example
In Bootstrap 4, how do I go about changing the background color of a navbar? The code from twbscolor doesn't work. I want to make the background color a different color and the font color white.
<nav class="navbar navbar-toggleable-md navbar-light bg-danger">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Jordan Baron</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home</a>
</li>
</ul>
</div>
</nav>
bootstrap-4 twitter-bootstrap-4
add a comment |
In Bootstrap 4, how do I go about changing the background color of a navbar? The code from twbscolor doesn't work. I want to make the background color a different color and the font color white.
<nav class="navbar navbar-toggleable-md navbar-light bg-danger">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Jordan Baron</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home</a>
</li>
</ul>
</div>
</nav>
bootstrap-4 twitter-bootstrap-4
i think you are missingnavbar-dark
as suggested in some answers. A quick code snippet at stackoverflow.com/a/47900899/2797254
– Weishi Zeng
Dec 20 '17 at 7:45
I better answer is here which includes a link to a css generator;
– Greg Gum
Dec 2 '18 at 19:01
add a comment |
In Bootstrap 4, how do I go about changing the background color of a navbar? The code from twbscolor doesn't work. I want to make the background color a different color and the font color white.
<nav class="navbar navbar-toggleable-md navbar-light bg-danger">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Jordan Baron</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home</a>
</li>
</ul>
</div>
</nav>
bootstrap-4 twitter-bootstrap-4
In Bootstrap 4, how do I go about changing the background color of a navbar? The code from twbscolor doesn't work. I want to make the background color a different color and the font color white.
<nav class="navbar navbar-toggleable-md navbar-light bg-danger">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Jordan Baron</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home</a>
</li>
</ul>
</div>
</nav>
bootstrap-4 twitter-bootstrap-4
bootstrap-4 twitter-bootstrap-4
edited Apr 27 '17 at 10:39
Zim
194k51409394
194k51409394
asked Apr 13 '17 at 0:16
hiboohiboo
151123
151123
i think you are missingnavbar-dark
as suggested in some answers. A quick code snippet at stackoverflow.com/a/47900899/2797254
– Weishi Zeng
Dec 20 '17 at 7:45
I better answer is here which includes a link to a css generator;
– Greg Gum
Dec 2 '18 at 19:01
add a comment |
i think you are missingnavbar-dark
as suggested in some answers. A quick code snippet at stackoverflow.com/a/47900899/2797254
– Weishi Zeng
Dec 20 '17 at 7:45
I better answer is here which includes a link to a css generator;
– Greg Gum
Dec 2 '18 at 19:01
i think you are missing
navbar-dark
as suggested in some answers. A quick code snippet at stackoverflow.com/a/47900899/2797254– Weishi Zeng
Dec 20 '17 at 7:45
i think you are missing
navbar-dark
as suggested in some answers. A quick code snippet at stackoverflow.com/a/47900899/2797254– Weishi Zeng
Dec 20 '17 at 7:45
I better answer is here which includes a link to a css generator;
– Greg Gum
Dec 2 '18 at 19:01
I better answer is here which includes a link to a css generator;
– Greg Gum
Dec 2 '18 at 19:01
add a comment |
5 Answers
5
active
oldest
votes
Update 2019
Remember that whatever CSS overrides you define must be the same CSS specificity or greater in order to properly override Bootstrap's CSS.
Bootstrap 4.1+
The Navbar is transparent by default. If you only want to change the background color, it can be done simply by applying the color to the <navbar class="bg-custom">
, but remember that won't change the other colors such as the links, hover and dropdown menu colors.
Here's CSS that will change any relevant Navbar colors in Bootstrap 4...
/* change the background color */
.navbar-custom
background-color: #ff5500;
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text
color: rgba(255,255,255,.8);
/* change the link color */
.navbar-custom .navbar-nav .nav-link
color: rgba(255,255,255,.5);
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:focus .nav-link,
.navbar-custom .nav-item:hover .nav-link
color: #ffffff;
Demo: http://www.codeply.com/go/U9I2byZ3tS
Override Navbar Light or Dark
If you're using the Bootstrap 4 Navbar navbar-light
or navbar-dark
classes, then use this in the overrides. For example, changing the Navbar link colors...
.navbar-light .nav-item.active .nav-link,
.navbar-light .nav-item:focus .nav-link,
.navbar-light .nav-item:hover .nav-link
color: #ffffff;
When making any Bootstrap customizations, you need to understand CSS Specificity. Overrides in your custom CSS need to use selectors that are as specific as the bootstrap.css. Read more
Transparent Navbar
Notice that the Bootstrap 4 Navbar is transparent by default. Use navbar-dark
for dark/bold background colors, and use navbar-light
if the navbar is a lighter color. This will effect the color of the text and color of the toggler icon as explained here.
Related: https://stackoverflow.com/a/18530995/171456
1
You're missing a comma in your css snippets. After.navbar-custom .nav-item:focus .nav-link
and.navbar-light .nav-item:focus .nav-link
– tnschmidt
Oct 9 '18 at 18:02
add a comment |
Update 2018 - Bootstrap v4.1+
Here's a much more simple way to change the navbar background color.
Just use .navbar-dark
instead of .navbar-light
and add your custom background color class like .bg-company-red
.navbar-dark
will make all your links white.
HTML
<nav class="navbar navbar-dark bg-company-red">
CSS style...
.bg-company-red
background-color: darkred !important;
See http://getbootstrap.com/docs/4.1/components/navbar/#color-schemes for official documentation.
Hi! I'm using webpack for all my external css files. Once I try to override styles from Bootstrap 4 I must use!important
rule, otherwise they are not applied. Does customization mechanism has changed in v4? With v3 I had no such problems
– Kuzma
Nov 9 '17 at 11:50
It's possible that you just need to be more specific in your CSS selector so that you don't need to use!important
. So instead of.special-class
trybody > header > .special-class
. Copy the selector that Bootstrap is using and then just make sure your override styles are included after the bootstrap styles.
– Chad
Nov 9 '17 at 16:58
1
Thanks for advice! I tried a lot of combinations, but onlyimportant!
changes properties. Very weird situation...
– Kuzma
Nov 9 '17 at 17:49
Well, it was my fault: I had the.bg-dark
class which already had!important
rule. Removing it solved the problem
– Kuzma
Nov 10 '17 at 16:27
add a comment |
I got it. This is very simple.
Using the class bg you can achieve this easily.
Let me show you:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full bg-primary"></nav>
This gives you the default blue navbar
If you want to change your favorite color, then simply use the style tag within the nav:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full" style="background-color: #FF0000">
add a comment |
If you read the bootstrap 4 documentation, Color schemes, it will answer your questions.
add a comment |
you can write !important in front of background-color property value like this
it will change the color of links.
.nav-link
color: white !important;
This is not a good idea. Use of !important is not a good practice and unnecessary.
– Zim
Dec 11 '18 at 12:44
add a comment |
protected by Zim Dec 11 '18 at 12:43
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Update 2019
Remember that whatever CSS overrides you define must be the same CSS specificity or greater in order to properly override Bootstrap's CSS.
Bootstrap 4.1+
The Navbar is transparent by default. If you only want to change the background color, it can be done simply by applying the color to the <navbar class="bg-custom">
, but remember that won't change the other colors such as the links, hover and dropdown menu colors.
Here's CSS that will change any relevant Navbar colors in Bootstrap 4...
/* change the background color */
.navbar-custom
background-color: #ff5500;
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text
color: rgba(255,255,255,.8);
/* change the link color */
.navbar-custom .navbar-nav .nav-link
color: rgba(255,255,255,.5);
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:focus .nav-link,
.navbar-custom .nav-item:hover .nav-link
color: #ffffff;
Demo: http://www.codeply.com/go/U9I2byZ3tS
Override Navbar Light or Dark
If you're using the Bootstrap 4 Navbar navbar-light
or navbar-dark
classes, then use this in the overrides. For example, changing the Navbar link colors...
.navbar-light .nav-item.active .nav-link,
.navbar-light .nav-item:focus .nav-link,
.navbar-light .nav-item:hover .nav-link
color: #ffffff;
When making any Bootstrap customizations, you need to understand CSS Specificity. Overrides in your custom CSS need to use selectors that are as specific as the bootstrap.css. Read more
Transparent Navbar
Notice that the Bootstrap 4 Navbar is transparent by default. Use navbar-dark
for dark/bold background colors, and use navbar-light
if the navbar is a lighter color. This will effect the color of the text and color of the toggler icon as explained here.
Related: https://stackoverflow.com/a/18530995/171456
1
You're missing a comma in your css snippets. After.navbar-custom .nav-item:focus .nav-link
and.navbar-light .nav-item:focus .nav-link
– tnschmidt
Oct 9 '18 at 18:02
add a comment |
Update 2019
Remember that whatever CSS overrides you define must be the same CSS specificity or greater in order to properly override Bootstrap's CSS.
Bootstrap 4.1+
The Navbar is transparent by default. If you only want to change the background color, it can be done simply by applying the color to the <navbar class="bg-custom">
, but remember that won't change the other colors such as the links, hover and dropdown menu colors.
Here's CSS that will change any relevant Navbar colors in Bootstrap 4...
/* change the background color */
.navbar-custom
background-color: #ff5500;
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text
color: rgba(255,255,255,.8);
/* change the link color */
.navbar-custom .navbar-nav .nav-link
color: rgba(255,255,255,.5);
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:focus .nav-link,
.navbar-custom .nav-item:hover .nav-link
color: #ffffff;
Demo: http://www.codeply.com/go/U9I2byZ3tS
Override Navbar Light or Dark
If you're using the Bootstrap 4 Navbar navbar-light
or navbar-dark
classes, then use this in the overrides. For example, changing the Navbar link colors...
.navbar-light .nav-item.active .nav-link,
.navbar-light .nav-item:focus .nav-link,
.navbar-light .nav-item:hover .nav-link
color: #ffffff;
When making any Bootstrap customizations, you need to understand CSS Specificity. Overrides in your custom CSS need to use selectors that are as specific as the bootstrap.css. Read more
Transparent Navbar
Notice that the Bootstrap 4 Navbar is transparent by default. Use navbar-dark
for dark/bold background colors, and use navbar-light
if the navbar is a lighter color. This will effect the color of the text and color of the toggler icon as explained here.
Related: https://stackoverflow.com/a/18530995/171456
1
You're missing a comma in your css snippets. After.navbar-custom .nav-item:focus .nav-link
and.navbar-light .nav-item:focus .nav-link
– tnschmidt
Oct 9 '18 at 18:02
add a comment |
Update 2019
Remember that whatever CSS overrides you define must be the same CSS specificity or greater in order to properly override Bootstrap's CSS.
Bootstrap 4.1+
The Navbar is transparent by default. If you only want to change the background color, it can be done simply by applying the color to the <navbar class="bg-custom">
, but remember that won't change the other colors such as the links, hover and dropdown menu colors.
Here's CSS that will change any relevant Navbar colors in Bootstrap 4...
/* change the background color */
.navbar-custom
background-color: #ff5500;
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text
color: rgba(255,255,255,.8);
/* change the link color */
.navbar-custom .navbar-nav .nav-link
color: rgba(255,255,255,.5);
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:focus .nav-link,
.navbar-custom .nav-item:hover .nav-link
color: #ffffff;
Demo: http://www.codeply.com/go/U9I2byZ3tS
Override Navbar Light or Dark
If you're using the Bootstrap 4 Navbar navbar-light
or navbar-dark
classes, then use this in the overrides. For example, changing the Navbar link colors...
.navbar-light .nav-item.active .nav-link,
.navbar-light .nav-item:focus .nav-link,
.navbar-light .nav-item:hover .nav-link
color: #ffffff;
When making any Bootstrap customizations, you need to understand CSS Specificity. Overrides in your custom CSS need to use selectors that are as specific as the bootstrap.css. Read more
Transparent Navbar
Notice that the Bootstrap 4 Navbar is transparent by default. Use navbar-dark
for dark/bold background colors, and use navbar-light
if the navbar is a lighter color. This will effect the color of the text and color of the toggler icon as explained here.
Related: https://stackoverflow.com/a/18530995/171456
Update 2019
Remember that whatever CSS overrides you define must be the same CSS specificity or greater in order to properly override Bootstrap's CSS.
Bootstrap 4.1+
The Navbar is transparent by default. If you only want to change the background color, it can be done simply by applying the color to the <navbar class="bg-custom">
, but remember that won't change the other colors such as the links, hover and dropdown menu colors.
Here's CSS that will change any relevant Navbar colors in Bootstrap 4...
/* change the background color */
.navbar-custom
background-color: #ff5500;
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text
color: rgba(255,255,255,.8);
/* change the link color */
.navbar-custom .navbar-nav .nav-link
color: rgba(255,255,255,.5);
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:focus .nav-link,
.navbar-custom .nav-item:hover .nav-link
color: #ffffff;
Demo: http://www.codeply.com/go/U9I2byZ3tS
Override Navbar Light or Dark
If you're using the Bootstrap 4 Navbar navbar-light
or navbar-dark
classes, then use this in the overrides. For example, changing the Navbar link colors...
.navbar-light .nav-item.active .nav-link,
.navbar-light .nav-item:focus .nav-link,
.navbar-light .nav-item:hover .nav-link
color: #ffffff;
When making any Bootstrap customizations, you need to understand CSS Specificity. Overrides in your custom CSS need to use selectors that are as specific as the bootstrap.css. Read more
Transparent Navbar
Notice that the Bootstrap 4 Navbar is transparent by default. Use navbar-dark
for dark/bold background colors, and use navbar-light
if the navbar is a lighter color. This will effect the color of the text and color of the toggler icon as explained here.
Related: https://stackoverflow.com/a/18530995/171456
edited Mar 7 at 12:31
answered Apr 13 '17 at 1:52
ZimZim
194k51409394
194k51409394
1
You're missing a comma in your css snippets. After.navbar-custom .nav-item:focus .nav-link
and.navbar-light .nav-item:focus .nav-link
– tnschmidt
Oct 9 '18 at 18:02
add a comment |
1
You're missing a comma in your css snippets. After.navbar-custom .nav-item:focus .nav-link
and.navbar-light .nav-item:focus .nav-link
– tnschmidt
Oct 9 '18 at 18:02
1
1
You're missing a comma in your css snippets. After
.navbar-custom .nav-item:focus .nav-link
and .navbar-light .nav-item:focus .nav-link
– tnschmidt
Oct 9 '18 at 18:02
You're missing a comma in your css snippets. After
.navbar-custom .nav-item:focus .nav-link
and .navbar-light .nav-item:focus .nav-link
– tnschmidt
Oct 9 '18 at 18:02
add a comment |
Update 2018 - Bootstrap v4.1+
Here's a much more simple way to change the navbar background color.
Just use .navbar-dark
instead of .navbar-light
and add your custom background color class like .bg-company-red
.navbar-dark
will make all your links white.
HTML
<nav class="navbar navbar-dark bg-company-red">
CSS style...
.bg-company-red
background-color: darkred !important;
See http://getbootstrap.com/docs/4.1/components/navbar/#color-schemes for official documentation.
Hi! I'm using webpack for all my external css files. Once I try to override styles from Bootstrap 4 I must use!important
rule, otherwise they are not applied. Does customization mechanism has changed in v4? With v3 I had no such problems
– Kuzma
Nov 9 '17 at 11:50
It's possible that you just need to be more specific in your CSS selector so that you don't need to use!important
. So instead of.special-class
trybody > header > .special-class
. Copy the selector that Bootstrap is using and then just make sure your override styles are included after the bootstrap styles.
– Chad
Nov 9 '17 at 16:58
1
Thanks for advice! I tried a lot of combinations, but onlyimportant!
changes properties. Very weird situation...
– Kuzma
Nov 9 '17 at 17:49
Well, it was my fault: I had the.bg-dark
class which already had!important
rule. Removing it solved the problem
– Kuzma
Nov 10 '17 at 16:27
add a comment |
Update 2018 - Bootstrap v4.1+
Here's a much more simple way to change the navbar background color.
Just use .navbar-dark
instead of .navbar-light
and add your custom background color class like .bg-company-red
.navbar-dark
will make all your links white.
HTML
<nav class="navbar navbar-dark bg-company-red">
CSS style...
.bg-company-red
background-color: darkred !important;
See http://getbootstrap.com/docs/4.1/components/navbar/#color-schemes for official documentation.
Hi! I'm using webpack for all my external css files. Once I try to override styles from Bootstrap 4 I must use!important
rule, otherwise they are not applied. Does customization mechanism has changed in v4? With v3 I had no such problems
– Kuzma
Nov 9 '17 at 11:50
It's possible that you just need to be more specific in your CSS selector so that you don't need to use!important
. So instead of.special-class
trybody > header > .special-class
. Copy the selector that Bootstrap is using and then just make sure your override styles are included after the bootstrap styles.
– Chad
Nov 9 '17 at 16:58
1
Thanks for advice! I tried a lot of combinations, but onlyimportant!
changes properties. Very weird situation...
– Kuzma
Nov 9 '17 at 17:49
Well, it was my fault: I had the.bg-dark
class which already had!important
rule. Removing it solved the problem
– Kuzma
Nov 10 '17 at 16:27
add a comment |
Update 2018 - Bootstrap v4.1+
Here's a much more simple way to change the navbar background color.
Just use .navbar-dark
instead of .navbar-light
and add your custom background color class like .bg-company-red
.navbar-dark
will make all your links white.
HTML
<nav class="navbar navbar-dark bg-company-red">
CSS style...
.bg-company-red
background-color: darkred !important;
See http://getbootstrap.com/docs/4.1/components/navbar/#color-schemes for official documentation.
Update 2018 - Bootstrap v4.1+
Here's a much more simple way to change the navbar background color.
Just use .navbar-dark
instead of .navbar-light
and add your custom background color class like .bg-company-red
.navbar-dark
will make all your links white.
HTML
<nav class="navbar navbar-dark bg-company-red">
CSS style...
.bg-company-red
background-color: darkred !important;
See http://getbootstrap.com/docs/4.1/components/navbar/#color-schemes for official documentation.
edited Feb 6 at 17:01
woodz
728
728
answered Sep 27 '17 at 21:48
ChadChad
8071432
8071432
Hi! I'm using webpack for all my external css files. Once I try to override styles from Bootstrap 4 I must use!important
rule, otherwise they are not applied. Does customization mechanism has changed in v4? With v3 I had no such problems
– Kuzma
Nov 9 '17 at 11:50
It's possible that you just need to be more specific in your CSS selector so that you don't need to use!important
. So instead of.special-class
trybody > header > .special-class
. Copy the selector that Bootstrap is using and then just make sure your override styles are included after the bootstrap styles.
– Chad
Nov 9 '17 at 16:58
1
Thanks for advice! I tried a lot of combinations, but onlyimportant!
changes properties. Very weird situation...
– Kuzma
Nov 9 '17 at 17:49
Well, it was my fault: I had the.bg-dark
class which already had!important
rule. Removing it solved the problem
– Kuzma
Nov 10 '17 at 16:27
add a comment |
Hi! I'm using webpack for all my external css files. Once I try to override styles from Bootstrap 4 I must use!important
rule, otherwise they are not applied. Does customization mechanism has changed in v4? With v3 I had no such problems
– Kuzma
Nov 9 '17 at 11:50
It's possible that you just need to be more specific in your CSS selector so that you don't need to use!important
. So instead of.special-class
trybody > header > .special-class
. Copy the selector that Bootstrap is using and then just make sure your override styles are included after the bootstrap styles.
– Chad
Nov 9 '17 at 16:58
1
Thanks for advice! I tried a lot of combinations, but onlyimportant!
changes properties. Very weird situation...
– Kuzma
Nov 9 '17 at 17:49
Well, it was my fault: I had the.bg-dark
class which already had!important
rule. Removing it solved the problem
– Kuzma
Nov 10 '17 at 16:27
Hi! I'm using webpack for all my external css files. Once I try to override styles from Bootstrap 4 I must use
!important
rule, otherwise they are not applied. Does customization mechanism has changed in v4? With v3 I had no such problems– Kuzma
Nov 9 '17 at 11:50
Hi! I'm using webpack for all my external css files. Once I try to override styles from Bootstrap 4 I must use
!important
rule, otherwise they are not applied. Does customization mechanism has changed in v4? With v3 I had no such problems– Kuzma
Nov 9 '17 at 11:50
It's possible that you just need to be more specific in your CSS selector so that you don't need to use
!important
. So instead of .special-class
try body > header > .special-class
. Copy the selector that Bootstrap is using and then just make sure your override styles are included after the bootstrap styles.– Chad
Nov 9 '17 at 16:58
It's possible that you just need to be more specific in your CSS selector so that you don't need to use
!important
. So instead of .special-class
try body > header > .special-class
. Copy the selector that Bootstrap is using and then just make sure your override styles are included after the bootstrap styles.– Chad
Nov 9 '17 at 16:58
1
1
Thanks for advice! I tried a lot of combinations, but only
important!
changes properties. Very weird situation...– Kuzma
Nov 9 '17 at 17:49
Thanks for advice! I tried a lot of combinations, but only
important!
changes properties. Very weird situation...– Kuzma
Nov 9 '17 at 17:49
Well, it was my fault: I had the
.bg-dark
class which already had !important
rule. Removing it solved the problem– Kuzma
Nov 10 '17 at 16:27
Well, it was my fault: I had the
.bg-dark
class which already had !important
rule. Removing it solved the problem– Kuzma
Nov 10 '17 at 16:27
add a comment |
I got it. This is very simple.
Using the class bg you can achieve this easily.
Let me show you:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full bg-primary"></nav>
This gives you the default blue navbar
If you want to change your favorite color, then simply use the style tag within the nav:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full" style="background-color: #FF0000">
add a comment |
I got it. This is very simple.
Using the class bg you can achieve this easily.
Let me show you:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full bg-primary"></nav>
This gives you the default blue navbar
If you want to change your favorite color, then simply use the style tag within the nav:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full" style="background-color: #FF0000">
add a comment |
I got it. This is very simple.
Using the class bg you can achieve this easily.
Let me show you:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full bg-primary"></nav>
This gives you the default blue navbar
If you want to change your favorite color, then simply use the style tag within the nav:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full" style="background-color: #FF0000">
I got it. This is very simple.
Using the class bg you can achieve this easily.
Let me show you:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full bg-primary"></nav>
This gives you the default blue navbar
If you want to change your favorite color, then simply use the style tag within the nav:
<nav class="navbar navbar-expand-lg navbar-dark navbar-full" style="background-color: #FF0000">
edited Dec 30 '17 at 2:19
sikander
2,1001222
2,1001222
answered Nov 18 '17 at 3:12
INONAMEINONAME
211
211
add a comment |
add a comment |
If you read the bootstrap 4 documentation, Color schemes, it will answer your questions.
add a comment |
If you read the bootstrap 4 documentation, Color schemes, it will answer your questions.
add a comment |
If you read the bootstrap 4 documentation, Color schemes, it will answer your questions.
If you read the bootstrap 4 documentation, Color schemes, it will answer your questions.
edited Mar 17 '18 at 15:41
Daniel
5,53042743
5,53042743
answered Dec 1 '17 at 11:20
antonjsantonjs
8,52375081
8,52375081
add a comment |
add a comment |
you can write !important in front of background-color property value like this
it will change the color of links.
.nav-link
color: white !important;
This is not a good idea. Use of !important is not a good practice and unnecessary.
– Zim
Dec 11 '18 at 12:44
add a comment |
you can write !important in front of background-color property value like this
it will change the color of links.
.nav-link
color: white !important;
This is not a good idea. Use of !important is not a good practice and unnecessary.
– Zim
Dec 11 '18 at 12:44
add a comment |
you can write !important in front of background-color property value like this
it will change the color of links.
.nav-link
color: white !important;
you can write !important in front of background-color property value like this
it will change the color of links.
.nav-link
color: white !important;
answered Dec 9 '18 at 20:05
Hamza ArshadHamza Arshad
11
11
This is not a good idea. Use of !important is not a good practice and unnecessary.
– Zim
Dec 11 '18 at 12:44
add a comment |
This is not a good idea. Use of !important is not a good practice and unnecessary.
– Zim
Dec 11 '18 at 12:44
This is not a good idea. Use of !important is not a good practice and unnecessary.
– Zim
Dec 11 '18 at 12:44
This is not a good idea. Use of !important is not a good practice and unnecessary.
– Zim
Dec 11 '18 at 12:44
add a comment |
protected by Zim Dec 11 '18 at 12:43
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
i think you are missing
navbar-dark
as suggested in some answers. A quick code snippet at stackoverflow.com/a/47900899/2797254– Weishi Zeng
Dec 20 '17 at 7:45
I better answer is here which includes a link to a css generator;
– Greg Gum
Dec 2 '18 at 19:01