PDA

View Full Version : link color problem



organ
04-07-2006, 07:27 PM
I defined two color style.

.style2 {font-size: 12px}
a {color: #000000; font-size: 12px}
a:hover{color: #80AD32; font-size: 12px}

.style1 {font-size: 12px}
a {color: #FFFFFF; font-size: 12px}
a:hover{color: #80AD32; font-size: 12px}

I don't know how to control, the link text only allow one color style. :(

Chris
04-07-2006, 07:38 PM
I'm not sure if thats valid syntax.... try this

a.style1 { blah blah}

Shyflower
04-07-2006, 08:02 PM
when you use pseudo classes for anchor links you need to use them in the followinig order:
a:link
a:visited
a:hover


also, the correct syntax for what you're trying to do is this:
.style2 {}
.style2 a {}
.style2 a:link {}
.style2 a:visited {}
.style2 a:hover {}

r2d2
04-08-2006, 04:02 AM
I defined two color style.

.style2 {font-size: 12px}
a {color: #000000; font-size: 12px}
a:hover{color: #80AD32; font-size: 12px}

.style1 {font-size: 12px}
a {color: #FFFFFF; font-size: 12px}
a:hover{color: #80AD32; font-size: 12px}

I don't know how to control, the link text only allow one color style. :(

As the others have said, but also the reason yours didn't work correctly is you are redefining a and a:hover in the second lot (after .style1..) You need to connect it to a class as the others have said.

Sean
04-08-2006, 06:43 AM
actually, I'm pretty sure you would want to do it this way:


a:link.style1 { }
a:visited.style1 { }
a:hover.style1 { }

a:link.style2 { }
a:visited.style2 { }
a:hover.style2 { }

or, if you're using the same attributes for both a:link and a:visited:


a:link.style1, a:visited.style1 { }
a:hover.style1 { }

a:link.style2, a:visited.style2 { }
a:hover.style2 { }

Shyflower
04-08-2006, 03:15 PM
actually, I'm pretty sure you would want to do it this way:

Actually no. If you define your class or id first to keep your cascade straight. Then all elements within that class or division will work within the subsets. Here's the link:

http://www.hotdesign.com/seybold/22navbars.html