Forum Moderators: not2easy

Message Too Old, No Replies

link classes

correct markup

         

brdwlsh

2:01 am on Mar 22, 2004 (gmt 0)

10+ Year Member



hi-

the following code relates to links that i have which should have a differnt style than my other links.

the links lie inside a <div> called rightcontent, which resides in a <div> called main.

[red]#main #rightcontent a.subnav:link{[/red]
font-family: helvetica, sans-serif;
font-size: 10px;
font-weight: 400;
color:#616161;
text-decoration:none;
}
[red]#main #rightcontent a.subnav:hover{[/red]
color:#000;
}

my subnav class is not working, the links just show up as the default blue with an underline. the color change works in the hover state.

why is this not working?

can i group active and visited with link?

is it necessary to use #main and #rightcontent in the property area?

the links in question are given the class subnav in the HTML

thanks

pageoneresults

2:06 am on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



#main, #rightcontent a.subnav:link{ 
font-family: helvetica, sans-serif;
font-size: 10px;
font-weight: 400;
color:#616161;
text-decoration:none;
}
#main, #rightcontent a.subnav:hover{
color:#000;
}

Try adding a comma separator for your ids.

brdwlsh

2:12 am on Mar 22, 2004 (gmt 0)

10+ Year Member



#main #rightcontent a.subnav:link, a.subnav:visited, a.subnav:active{
font-family: tahoma, verdana, geneva, arial, helvetica, sans-serif;
font-size: 10px;
font-weight: 400;
color:#616161;
text-decoration:none;
margin:5px;
padding:0
}
#main #rightcontent a.subnav:hover{
color:#000;
}

i screwed up the order of visited and active in my original stylesheet!

are there any advantages to putting commas between ID's?

can i condense the code that i have?

thanks

grahamstewart

9:16 am on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, ignore that. There should be NO comma there.

Also..


#main #rightcontent a.subnav:link, a.subnav:visited, a.subnav:active{

won't quite work as expected. That selector says Styles for a:active of class "subnav" OR a:visited of class "subnav" OR a:link of class "subnav" which has a parent called #rightcontent which has a parent called #main.

What you'd really want is..


#main #rightcontent a.subnav:link,
#main #rightcontent a.subnav:visited,
#main #rightcontent a.subnav:active{

..but I doubt that you really need to be that specific.

Why not just apply the styles to the subnav class in general? like this..


a.subnav:link, a.subnav:visited, a.subnav:active{

and since you are setting :link, :visited and :active to the same thing then you can compress that a bit further to be..

a.subnav {
font: bold 10px tahoma, verdana, geneva, arial, helvetica, sans-serif;
color:#616161;
text-decoration:none;
margin:5px;
padding:0
}
a.subnav:hover{
color:#000;
}