Solved

Bootstrap change nav font color

Posted on 2014-09-30
10
539 Views
Last Modified: 2014-09-30
Hi, I have this page: codedivasites.com/new/

I want to change the nav font color for about, services, etc to black, with a white hover, like the HOME.

I have custom CSS of:
a.navbar-custom:link {
    color: #000;
}


a.navbar-custom:visited {
    color: #000;
}


a.navbar-custom:hover {
    color: #FFF;
}


a.navbar-custom:active {
    color: #FFF;
}

And in the html I have:
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-custom">
                    <li>
                        <a href="about.html">About</a>
                    </li>
                    <li>
                        <a href="services.html">Services</a>
                    </li>
                    <li>
                        <a href="portfolio.html">Portfolio</a>
                    </li>
                    <li>
                        <a href="contact.html">Contact</a>
                    </li>
                </ul>

I'm not sure where I'm going wrong. Thanks for your help.
0
Comment
Question by:mel200
  • 4
  • 4
  • 2
10 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40352339
You do not have any a tags with the class navbar-custom.

I think what you want is: .navbar-custom a:link etc

Cd&
0
 

Author Comment

by:mel200
ID: 40352346
Argh. Thanks.
0
 

Author Comment

by:mel200
ID: 40352364
ok, changed it to this,  but still not working on my browser. (Using red so it's easier to see when it's done, will change that later):

 .navbar-custom a:link {
    color: #ff000;
}


.navbar-custom:a.visited {
    color: #ff000;
}


.navbar-custom:a.hover {
    color: #FFF;
}


.navbar-custom:a.active {
    color: #FFF;
}
0
 
LVL 10

Accepted Solution

by:
jtwcs earned 500 total points
ID: 40352395
The last three of your declarations above are still not correct as you have the : in the wrong place.  They should be like the a:link one.

The below styles are more specific and should be what you are looking for.
#bs-example-navbar-collapse-1 .navbar-custom a:link, #bs-example-navbar-collapse-1 .navbar-custom a:visited {
    color: #000000;
    font-size: 18px;
}
#bs-example-navbar-collapse-1 .navbar-custom a:hover, #bs-example-navbar-collapse-1 .navbar-custom a:active {
    color: #FFFFFF;
}

Open in new window

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40352563
Yeah the typo screws up the declarations.  If it still isn't working you will need to post a link so I can see how the bootstrap bloat is interfering with what would be a ten second change in a normal stylesheet.

Cd&
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:mel200
ID: 40352819
ah, sorry about that. It's fixed, but still not working. You can see the html at: codedivasites.com/new/index.html and the css at
codedivasites.com/new/css/main.css and codedivasites.com/new/css/bootstrap.css and codedivasites.com/new/css/bootstrap.min.css.

Thanks.
0
 
LVL 10

Expert Comment

by:jtwcs
ID: 40352840
Did you try the declarations that I posted earlier?  They are more specific and will override the other bootstrap declarations.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40352857
The font color is coming from the declaration:  .navbar-inverse .navbar-nav > li > a {

In bootstrap.min.css

So you have to go into the bootstrap junk and do the change that would have taken seconds to locate and change if you were using your own styling instead of the third party junk.

Cd&
0
 

Author Closing Comment

by:mel200
ID: 40352866
I apologize, I somehow skimmed over that. It works, thanks so much!
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40352871
>>>Did you try the declarations that I posted earlier?  They are more specific and will override the other bootstrap declarations.

Why would you want to hack it by adding more bloated to already bloated collection of junk declarations, and cripple the cascade even more than it is by binding the content and presentation which is exactly opposite of how CSS is supposed to be used?

Cd&
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to count occurrences of each item in an array.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now