Sonny Black
Sonny Black

Reputation: 1617

How to change css on link current class

How do I make my font color white, on the current nav bar class?

For example, when I click on a link on the nav it adds a class="current" to that link.

But I'm having trouble styling that particular link.

Here's the HTML:

<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-loggedin-nav mineul pull-right" style="font-size:22px;margin-top:7px; color:white;">
<li>
<a class="current" href="/">
</li>
<li>

Here's my CSS attempt which is way off:

.nav > li > a .current {
    color: white;
}

Upvotes: 0

Views: 245

Answers (3)

Rafael
Rafael

Reputation: 7746

HTML

<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-loggedin-nav mineul pull-right" style="font-size:22px;margin-top:7px; color:white;">
<li>
<a class="current" href="/">Text Here</a>
</li>
<li>

CSS

a.current {
    color: white;
}

Upvotes: 0

Ricky Goldman
Ricky Goldman

Reputation: 349

.nav > li > a.current

Just a small change. The space between "a" and ".current" makes it think .current is a new element.

Upvotes: 1

david_i_smith
david_i_smith

Reputation: 228

No space between the anchor element selector and the class name selector:

.nav > li > a.current {
    color: white;
}

Upvotes: 0

Related Questions