stop link from changing colors

Posted on 2003-03-12
Medium Priority
Last Modified: 2010-04-09
how can i make a link that somone clicks on my site stop from changing colors after its been clicked, kinda like how the navigation is on this site.
Question by:proof1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 8124145
<style type="text/css">
     A:link { color: blue }
     A:active { color: blue }
     A:visited { color: blue }
     A:hover { color: blue }

just change the color to whatever you want including in the format #000000

Expert Comment

ID: 8124166
bobbit has it right.  
A:link -- changes normal color
A:active -- changes color when it is being clicked on
A:visited -- changes color after it has been clicked
A:hover -- changes color when the mouse is over the link

Expert Comment

ID: 8124310
Another, easier solution:

For one link on a page:

<a style="text-decoration: none" href="index.asp">

For all links on a page:

A     {text-decoration: none;}

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.


Expert Comment

ID: 8124441
bobbit31 is correct. That stops the link from changing colour, because you have used the same colour for all states of the link. However, for compliance with standards, you should use a lower case "a", not an uppercase one.

CRaqsdells' solution only removes the underlining from the link. It will not stop it changing colours.


Accepted Solution

Bardicstorm earned 60 total points
ID: 8125195
For clearer reference, while bobbit31 is indeed correct, use the following within your header tags if you want to do it with CSS (best option):

<style type="text/css">
  a:link { color: #CCCCCC; }
  a:active { color: #CCCCCC; }
  a:visited { color: #CCCCCC; }
  a:hover { color: #CCCCCC; }
<!-- please note that the 'color: #CCCCCC;' is surrounded by curly brackets and not parenthesis, also note the trailing semi-colon after the color. Also of note is that a:hover does not work with all browsers. -->

If you want to do it without CSS (which is not advised), place the following attributes within the body tag:

<body link="#CCCCCC" alink="#CCCCCC" vlink="#CCCCCC">
<!-- link = normal link color, alink = active link color (on a click event), and vlink = visited link color. -->

The CSS option is by far the better option.

Expert Comment

ID: 8125217
.. or you can put it in an external style sheet.

Expert Comment

ID: 8131932
Another option is to avoid the <a> tag and instead call an onclick on the <td>


<script language="JavaScript">

function openNewPage(thePage) {
     nwin=window.open(thePage, "_new",config="scrollbars=yes,resizable=yes,toolbar=yes,location=yes,status=yes,menubar=yes,");


<td style="cursor:hand" onclick="openNewPage('http://www.msn.com')">Click Here</td>

But with this example, the text has no formatting at all so you probably want to spruce it up some so they know it's a hyperlink.  Perhaps underlining it.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question