Style Anchor Tags

Giganews Newsgroups
Subject: Style Anchor Tags
Posted by:  Shapper (mdmou…@gmail.com)
Date: Sun, 4 Sep 2011

Hello,

I have the following HTML:

<p>This is an <a href="#">Anchor</a>.</p>

I am styling the anchor as follows:

p {
  color: #333;
  font: normal 1em/1.5em Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

p a:link, p a:visited, p a:focus {
  color: #444;
  text-decoration: underline;
}
        
p a:link:hover, p a:visited:hover, p a:focus:hover,
p a:link:active, p a:visited:active, p a:focus:active {
  color: #222;
  text-decoration: none;
}

1 - Is this the best way to style anchors?

2 - Shouldn't I also define the 'a' tag alone?

3 - And what about defining the default style for anchors?
    Should I use something like:

a {
  color: #333;
  font: normal 1em/1.5em Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

a:link, a:visited, a:focus {
  color: #444;
  text-decoration: underline;
}
        
a:link:hover, a:visited:hover, a:focus:hover,
a:link:active, a:visited:active, a:focus:active {
  color: #222;
  text-decoration: none;
}

--

Thank You,
Miguel

Replies