different rollover links per page

Brooke's picture

She has: 681 posts

Joined: Feb 1999

I know someone asked this question before, but I can't find it.

How do I get one link to have one set of colors for link, rollover, visted, and another link with another set of colors?

The other problem I have having is that frontpage makes you set background colors (link,rollover,visited) and I don't know how to bypass that.

Any help would be greatly appreciated!

Brooke

------------------
Providing quality websites for businesses and individuals!
www.cataluna.com

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Use CSS to define a different class for each type of link. You would then have something like this in your header:

<STYLE TYPE="text/css">
<!--
A.type1 {color: red}
A.type1: visited {color: black}
A.type1: hover {color: blue}

(makes red links with blue hover effect)

A.type2 {color: green}
A.type2: visited {color: white}
A.type2: hover {color: blue}

(makes green links with blue hover effect)
-->
</STYLE>

Then when you define the link tag you just put CLASS="type1" (or type2 as the case may be) in the tag like so:

<a href="url.html" class="type1">Link Text</A>

You can use other CSS font styles like text-decoration: none to get rid of the underline, font-weight, font-family, whatever you want.

I'm pretty sure that Webmonkey had an article about this type of thing... yup, here's the URL:
http://hotwired.lycos.com/webmonkey/99/28/index0a.html

I don't know about the frontpage thing - my recommendation would be to learn the CSS yourself.

[This message has been edited by Megan Jack (edited 02 March 2000).]

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Megan,

Thank you so much! I will need to play with that for a bit so I understand everything!

Thanks again!

Brooke

------------------
Providing quality websites for businesses and individuals!
www.cataluna.com

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Megan,

Okay! Got it working! Thanks a million. Now I have one more question. I want the text to have the underline when you rollover it. It does before I click the link. Then once it has been visited the underline will no longer work. Any ideas?

Brooke

------------------
Providing quality websites for businesses and individuals!
www.cataluna.com

They have: 152 posts

Joined: Dec 1999

<STYLE TYPE="text/css">
<!--
A.type1 {color: red}
A.type1: visited {color: black}
A.type1: text-decoration: underline; hover {color: blue}

(makes red links with blue hover effect)

A.type2 {color: green}
A.type2: visited {color: white}
A.type2: text-decoration: underline; hover {color: blue}

(makes green links with blue hover effect)
-->
</STYLE>

Hope that helps

------------------
-RJ D'Angelo
D'Angelo Web Design

http://www.dangelowebdesign.com

They have: 117 posts

Joined: Feb 2000

Megan or Dangelo,

I also got this to work, and let me add my thanks to Brooke's. However, I have another question. I set it up so the link was blue, hover was dark blue and visited was blue. This worked great, but once the link was visited and turned blue, the hover to dark blue would no longer work. Any way to get it to still change to the hover color once the link is visited? Thanks.

Bob

Brooke's picture

She has: 681 posts

Joined: Feb 1999

I am about to run around jumping for joy I am sooooo excited. I figured it out thanks to someone's source code. So, to keep the hover working after you click on the link this is what you have to do:

a.type1:link{text-decoration:none;color:#000000}
a.type1:visited{text-decoration:none;color:#000000}
a.type1:active{text-decoration:none;color:#9400D3}
a.type1:hover{text-decoration:underline;color:#9400D3}

It's the ACTIVE that makes it work!

Thanks to EVERYONE!

Brooke

------------------
Providing quality websites for businesses and individuals!
www.cataluna.com

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I read somewhere that browsers sometimes have problems using CSS on visited links. I forget where I was reading this, but apparently it's something you just have to live with.

Brooke's picture

She has: 681 posts

Joined: Feb 1999

Bob,

That's the same problem I am having with the underline not working after the link has been visited.

If it's something we have to live with, okay - but I know that I have seen it working on other sites, so if anyone does have an answer, please let us know!

Brooke

------------------
Providing quality websites for businesses and individuals!
www.cataluna.com

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

FYI, you have to have the links in a specific order as well.

In CSS, it must be
a:link
a:visited
a:active
a:hover

Any other order (except to switch link and visited) will result in the CSS being invalid.

Suzanne

------------------
Zero Cattle
Suzanne
Tables DeMystified

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.