Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS class not changing font color

Tags:

html

css

colors

I have this code that I am working on in CSS. For some reason the class will not change the color of the paragraph and I am unsure as to why.

<div id="formsHead">
    <div id="loginT" class="active">
        <p id="loginL">Login</p>
    </div>
    <div id="registerT" class="active">
        <p id="registerR">Register</p>
    </div>
</div>

#loginT{
    float:left;
    width:50%;
    height:100%;
}
#registerT{
    float:left;
    width:50%;
    height:100%;
}
.active{
    background:#ecf0f1;
}
.active p{
        color:#34495e;
}

Here is a jsFiddle of the full code:

http://jsfiddle.net/nvmzygqg/

like image 856
hudsond7 Avatar asked Feb 10 '26 07:02

hudsond7


1 Answers

Your selector needs to be more specific. In your example it's being overriden by the #formsHead p selector. Adding the ID of each parent in your example will do the trick:

#loginT.active p,
#registerT.active p {
    color: #34495e;
}
like image 196
Adrift Avatar answered Feb 17 '26 09:02

Adrift



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!