Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override Anchor color to inherit the default color

I'm trying to override the anchor color and set the color to be what it normally would have been without the link.

a .right {
    color:inherit;
}
a:link .right {
    color:inherit;
}
<a href="...">
    <div class="right">
        <div class="text">
            Some Text
        </div>
    </div>
</a>

Neither seem to be working.

like image 648
N V Avatar asked Apr 30 '12 21:04

N V


1 Answers

Put a class on the anchor itself and then set:

.yourAnchorClass { color: inherit; }

See fiddle example.

Inheritance is from the parent element. So all your solutions are doing is telling the divs to inherit the color of the anchor. By the way, it is actually invalid HTML4 to have a div inside an a tag (a block level element inside an inline element). If you can, it would be best to change those to span and then set display: block on the span elements inside the a.

like image 144
ScottS Avatar answered Oct 11 '22 21:10

ScottS