NameSilo

Anchor Tag Problem

Spaceship Spaceship
Watch

Tree

Established Member
Impact
9
In my CSS, I have

HTML:
A:link { 
color: #530000; 
font-weight: bold; 
text-decoration: none; 
}

A:active { 
color: #530000; 
font-weight: bold; 
text-decoration: none; 
}

A:visited { 
color: #530000; 
font-weight: bold; 
text-decoration: none; 
}

A:hover { 
color: #9E0000; 
font-weight: bold; 
text-decoration: none; 
}

.nav A:link {text-decoration: none; }

.nav A:active {text-decoration: none; }

.nav A:visited {text-decoration: none; }

.nav A:hover { 
color: #9E0000; 
font-weight: bold; 
text-decoration: none; 
}

However, the .nav's aren't working. What do I need to do to have the .nav anchors different than the regular anchors?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Try taking the A:link specification out, so you've just got:
HTML:
.nav {text-decoration: none; }
 
0
•••
0
•••
Give a main div the class nav and dont use classes in the <a href="" it should solve the problem
 
0
•••
The following CSS works fine for different anchor properties:

PHP:
A.nav:link {color: red; text-decoration: none; }

A.nav:visited {color: blue; text-decoration: none; }

A.nav:hover { 
color: yellow; 
font-weight: bold; 
text-decoration: none; 
}

A.nav:active {color: green; text-decoration: none; }
use: <a class="nav" href="...">...</a>

note that the order of link, visited, hover and active is important. For reference: http://www.w3schools.com/css/css_pseudo_classes.asp
 
0
•••
I figured it out. Thanks. :)
 
0
•••
Code:
A:link { 
  color: #530000; 
  font-weight: bold; 
  text-decoration: none; 
}

A:active { 
  color: #530000; 
  font-weight: bold; 
  text-decoration: none; 
}

A:visited { 
  color: #530000; 
  font-weight: bold; 
  text-decoration: none; 
}

A:hover { 
  color: #9E0000; 
  font-weight: bold; 
  text-decoration: none; 
}

You can shorten all of that to:

Code:
a:link, a:active, a:visited, a:hover {
  color: #530000; 
  font-weight: bold; 
  text-decoration: none; 
}
a:hover {
  color: #9E0000; 
}

You could make the rest a lot shorter, too.

If you are giving the link a class (<a class="class">), than you would do:
a.class:link, a.class:active, a.class:visited, a.class:hover

If you had a lot of links you wanted to do that to, you should do:
<span class="links"><a href=""></a><a href=""></a></span>
and:
.links a:link, .links a:visited, .links a:active, .links a:hover
 
1
•••
Thanks Dan! +Rep :)
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back