Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

stop link from changing colors

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.
0
proof1
Asked:
proof1
1 Solution
 
bobbit31Commented:
<style type="text/css">
     A:link { color: blue }
     A:active { color: blue }
     A:visited { color: blue }
     A:hover { color: blue }
</style>

just change the color to whatever you want including in the format #000000
0
 
superslamwichCommented:
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
0
 
CRagsdellCommented:
Another, easier solution:

For one link on a page:

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

For all links on a page:

<STYLE>
A     {text-decoration: none;}
</STYLE>

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kasandraCommented:
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.

0
 
BardicstormCommented:
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; }
</style>
<!-- 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.
0
 
kasandraCommented:
.. or you can put it in an external style sheet.
0
 
WebDevAngCommented:
Another option is to avoid the <a> tag and instead call an onclick on the <td>

Example:

<script language="JavaScript">
<!--

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

//-->
</script>



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

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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now