tags:

views:

49

answers:

4

This site is turning into a mess. I can't seem to get the left side navigation to look the way I want.

I think it's something simple but I can't see it.

this is the CSS:

a.col1:link {color:#FFF}      /* unvisited link */
a.col1:visited {color:#00F}  /* visited link */
a.col1:hover {color:#FF0}  /* mouse over link */
a.col1:active {color:#00F}  /* selected link */

here is the html:

<ul class="col1"><li><a href="see_autos.asp>car</a></li></ul>
+2  A: 

You need to apply the styles of the CSS pseudo-class directly to the A tags themselves. As you show, they are descendants of the UL LI tags in your structure, so that's how you can select them.

ul.col1 li a:link {color:#FFF}      /* unvisited link */
ul.col1 li a:visited {color:#00F}  /* visited link */
ul.col1 li a:hover {color:#FF0}  /* mouse over link */
ul.col1 li a:active {color:#00F}  /* selected link */
micahwittman
+1, but for what I can tell by the original, it's more like `.col1 a:link {color:$FF}`. That is, OP doesn't want to be this specific. Unless you just want to increase weight.
Michael Krelin - hacker
`#fff` of course.
Michael Krelin - hacker
hacker, could be. More details from OP needed.
micahwittman
All the suggestions were good but using this one allowed me to just go to the CSS copy and paste over what I had and IT WORKS! This CSS stuff is not easy to wrap your brain around.thanks!!!
Drea
*sigh*. you really should be careful. You are having trouble because you are just copying and pasting and not understanding how CSS is working. This one is very specific and will cause you trouble once you start changing things, but you'll learn...
Paul Tarjan
+5  A: 

First you need a " to end your href.

Second, your class is not on your a, it is on the parent, so your css should be something like

.col1 a:link {color:#FFF}

Third, please don't name it col1, a semantic name is better left-nav or sidebar is better.

Paul Tarjan
All good points.
Nathan Long
`left-nav`? if we're going for semantic, how about just `nav`
nickf
good point... I'm still learning about the semantic part of it. Is it important just so it's easy to remember?
Drea
No, so when you move everything around you can preserve class names. Your `nav` won't change but it might move from the left to the top. Its also useful for webcrawlers with microformats, etc.
Paul Tarjan
+1  A: 

Your CSS expects the col1 to be a class of the <a> element. But you have assigned it to the <ul> element. So to fix this you need to change HTML as follows

<ul><li><a href="see_autos.asp" class="col1">car</a></li></ul>

so that it is assigned to the right element, or to change CSS as follows

ul.col1 a:link {color:#FFF}      /* unvisited link */
ul.col1 a:visited {color:#00F}  /* visited link */
ul.col1 a:hover {color:#FF0}  /* mouse over link */
ul.col1 a:active {color:#00F}  /* selected link */

so that it is assigned to any child <a> elements of the <ul class="col1"> element.

BalusC
good comment but I ended up using the previous suggestion.
Drea
A: 

Since the anchor is a child of the unordered list, your css should specify child anchors of the unordered list as such:

.col1 a:link
{
    color...
}
JYelton
thank you for taking the time to look at this. I picked the 2nd answer
Drea