I use two different a:link/a:visited/a:hover tags.. But the links in .panel take over the a:link/a:visited from .footer and only gets a:hover from .panel right.
HTML
<div class="panel" id="tab4"><b><a href="#" target="_blank">Title</a> – Name</b>
CSS
.panel a:link, a:visited {
color:#333;
text-decoration:none;}
.panel a:hover {
color:#000;
text-decoration:none;
border-bottom:1px solid #000;}
.footer a:link, a:visited {
color:#fff;
text-decoration:none;
opacity:0.8;
filter:alpha(opacity=80); /* For IE8 and earlier */}
.footer a:hover {
color:#fff;
text-decoration:none;
border-bottom:1px solid #fff;
opacity:1.0;
filter:alpha(opacity=100); /* For IE8 and earlier */}
CSS rules are a comma delimited list which are parsed by the browser right to left, top to bottom. When you do the following:
.panel a:link, a:visited{
/*things*/
}
.footer a:link, a:visited {
/*more things*/
}
The browser is saying:
anchor
which is visited
, do these rules. Then for any anchor link
with a class of panel
, do these same rules."anchor
which is visited
, do these second rules {over writing your step one}, and for anything with the class
of footer
, do these second rules again."So, make sure you have enough CSS specificity to correctly target what you're looking to target.