Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link colo change?

Status
Not open for further replies.

rjwilldohisbest

Technical User
Jun 2, 2001
79
US
Hi All.

I have been looking around many places and am trying to employ a style for links, active, visited, hover, etc.

I have put them on an external css sheet and I haven't had much luck with getting the code to work.

a:link { color:#0000ff; }
a:visited { color:#ff00ff; }
a:active { color:#ff0000; }
a:hover { color:#ff0000; }

I have copied tutorials, switched pieces around, even tried issuing the pieces as combined expressions, and using them internally. If anyone would know what I may be doing wrong that would be great.
I'm using IE 5.5 and the code for hover doesn't work with ns from what the tutorial mentioned
Thanks for your time.

RJ
 
Will this work?
Code:
<html>
<head>
	<title>My Page</title>
<style type=&quot;text/css&quot;>
a:link { color:#0000ff; }
a:visited { color:#ff00ff; }
a:active { color:#ff0000; }
a:hover { color:#ff0000; }
</style>
</head>

<body>

<a href=&quot;somewhere.html&quot;>somewhere</a>

</body>
</html>
If so, just cut the stuff out between the
Code:
style
tags out and put it in a .css file (don't include the
Code:
style
tags themselves!).

Then take the
Code:
style
tags out completely and replace them with this:
Code:
<link rel=stylesheet type=&quot;text/css&quot; title=&quot;mycss&quot; href=&quot;mycss.css&quot;>
(or whatever it was that you called your stylesheet). Check to make sure your path is right if you don't have the stylesheet in the same directory. If all else fails you can always put the whole URL in the
Code:
href
part.

Good luck!
 
The links work but the colors still do not work.
external or internal I get the same thing, nada.
Now Im really stumped?
 
Hmm... it's the way I've been doing links for years and it always works in IE 4.0 and up (no Netscape). Perhaps a bad IE install? Maybe you can find another machine to test the same page on, I think your code is fine.
 
The body scrollbar colors work but not the links.
I have the links (The a attribute) right underneath the body section in the css. I may have to put them in directly in the href line if this doesn't work.

Is there a javascript equivalent of an external sheet i could write up? I'll keep trying. Thanks.

RJ
 
Did you try that shortened example? If all else fails you could try putting the style right in a <div> tag around the stuff you are linking, but I doubt that would be any better. There is no reason why you shouldn't be able to see this -- unless you're on an off-the-beaten-path operating system or something.

You could also go around the problem and try a combination of
Code:
onMouseOver
and
Code:
onMouseOut
but seriously it must be your browser.
 
Hi again.

I saw the prob. A while ago I had declared the font within the href, this I found out will override any css statments that had been previoudly noted. I deleted the font statments that were in there, geeez, lol. Soory about that.

Works now :)

Thanks for your time.
 
Oh whoops! Yep, the closest one wins so the font tag right next to the text will win over an external style sheet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top