Anchor Tag Problem

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Try taking the A:link specification out, so you've just got:
HTML:
.nav {text-decoration: none; }
 
0
Close
0
Close
Give a main div the class nav and dont use classes in the <a href="" it should solve the problem
 
0
Close
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
Close
I figured it out. Thanks. :)
 
0
Close
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
Close
Thanks Dan! +Rep :)
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back