How to have more than one color in hypertext underlines?

You can use CSS to set the color for hypertext links, with a different color for links that you have yet to follow, ones you have followed, and the active color for when the link is being clicked. You can even set the color for when the mouse pointer is hovering over the link.

  :link { color: rgb(0, 0, 153) }  /* for unvisited links */
  :visited { color: rgb(153, 0, 153) } /* for visited links */
  :active { color: rgb(255, 0, 102) } /* when link is clicked */
  :hover { color: rgb(0, 96, 255) } /* when mouse is over link */


Another easy way to is to suggest different colors is to assign classes to the CSS anchor pseudo-class, such as:

      	a.important:link 
	{
	color: red;
        background: white;
        text-decoration: none;
	}
      a.onsite:link 
	{
	color: blue;
        background: white;
        text-decoration: none;
	}
      a.internal 
	{
	color: green;
        background: white;
        text-decoration: none;
     }


Then, simply call them out in the html with: <P><A CLASS="important" HREF="http://www.programmersheaven.com” "> Programmers heaven site</A></P> <P><A CLASS="onsite" HREF="anchors.html">This document</A></P> <P><A CLASS="internal" HREF="#links">Links</A></P>

Back

 
Printer friendly version of the CSS-FAQ-Multiple-Colors-In-Hypertext-Underlines page


Sponsored links

ASP.NET 3.5 Hosting on Windows 2008!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
Experience Adobe? FLASH MEDIA SERVER 3
Introducing the media solution for total action without interruption. TRY IT NOW FOR FREE!

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.