Forum Moderators: not2easy

Message Too Old, No Replies

How do I set more than one link color using CSS?

         

pigsinpink

3:00 pm on Dec 10, 2006 (gmt 0)

10+ Year Member



I know how to set only one link color for link, visited and active links using an external stylesheet. Is there a way to program stylesheets so I can have more than one link color showing up on a page?

jbinbpt

3:06 pm on Dec 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What would the trigger event be? When they first load, on click?

I suppose you could inline style them.

abbeyvet

3:26 pm on Dec 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you mean that you want to have different link colors/styles in different areas of the page - like one style in the content part, but different ones in, say, the footer and/or a left column?

If so, then it is easy.

You can apply link styles to links in just one div - like this for example:

#footer a {color:#ccc; text-decoration:none;}
#footer a:hover {color:#ccc; text-decoration:underline;}

That means that in the div with the id footer ONLY, your links will be pale grey and underlined on hover only.

Repeat with as many divs and link styles as you wish.

pigsinpink

6:35 pm on Dec 10, 2006 (gmt 0)

10+ Year Member



Sorry I meant I wanted to have different link colors in different parts of a page. The problem I'm having with CSS is that I can only set one link color. I.e if I set the active links in the content area as blue, i couldn't have another active link to be, say a red color. The red would override the blue color.