Quackit Logo
FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
Create free Flash websites

CSS Hyperlinks

Print Version

You can use CSS to change the appearance and behavior of hyperlinks.

To do this, you can use the following selectors/pseudo-classes:

  • a
  • a:link
  • a:visited
  • a:hover
  • a:active

These selectors/pseudo-classes represent the 'anchor' element (specified using the HTML 'a' tag) and its various states.

Examples

Some nice effects can be achieved by using the text-decoration property in conjunction with the color property.

Here's an example of the code that you might insert into a style sheet to achieve the desired effect.


a {font-family:Georgia,serif; font-size:large}
a:link {color:blue;}
a:visited {color: #660066;}
a:hover {text-decoration: none; color: #ff9900;
font-weight:bold;}
a:active {color: red;text-decoration: none}

Note that the a:hover must be placed after the a:link and a:visited rules, since otherwise the cascading rules will hide the effect of the a:hover rule. Similarly, because a:active is placed after a:hover, the active color (red) will apply when the user both activates and hovers over the 'anchor' element.

Hyperlinks with no underline.

a:link { text-decoration: none }

It can confuse your users if your hyperlinks aren't underlined. A more usable solution would be only to apply this behaviour to hyperlinks only when users hover over them.

Text rollovers

a:hover { text-decoration: none }

Use the a:hover selector.

Cursor effects

a:hover { cursor:help }

Use the cursor declaration.

Try it yourself!


Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
$1.99 .info domain names!
© Copyright 2000 - 2010 Quackit.com