Connecting Tech Pros Worldwide Help | Site Map

Links and Classes

Member
 
Join Date: Sep 2007
Posts: 47
#1: Sep 21 '07
Hi everyone,

I've been asking many questions . . . and have yet another one!

I've been trying to do something as simple as changing a link color in a class, but it's not working for me.

The CSS code is:
Expand|Select|Wrap|Line Numbers
  1. .sidebar {
  2. position:       absolute;
  3. width:          165px;
  4. top:            0px;
  5. left:           5px;
  6. border-right:    1px solid;
  7. }
  8.  
  9. a.sidebar:link {color:white;}
  10.  
  11. a.sidebar:visited {color:white;}
Everywhere I look as I learn CSS, it appears this should work! I tried simply to have "a.sidebar {color: white}" to change all link attributes instead of specifying each individual one like link, visited, hover, active. But that wasn't working, so to be safe I just did the above code for testing purposes. But still nothing is working.

The section of the page code is,

Expand|Select|Wrap|Line Numbers
  1. <div class="sidebar">Test Test Test Test Test Some Text for Testing, and some more and more and more and more and more and more and more and are you <a href="workmenforChrist.org">Link</a> reading this and this and this and how about some of this, did you catch that and this and some more and some more text and test text?</div>
Shouldn't this work? Or am I supposed to put a class in the link tag itself as well? I tried doing something like that before and that still didn't work. So . . . what in the world am I missing?!

Thanks in advance for your help . . . I do appreciate it. And I really appreciate the patience of those who have been helping me in my other threads too!

~Michael
Newbie
 
Join Date: Jun 2007
Posts: 16
#2: Sep 21 '07

re: Links and Classes


Try this

Expand|Select|Wrap|Line Numbers
  1. .sidebar a:link, .sidebar a:visited{color:#ffffff;}
Try to find a good article describing how the Cascade works in 'Cascading Style Sheets'

First you want to go into your class .sidebar then you want your anchor links (a) inside the sidebar to be colored white, same with your visited.

Also try using the RGB code for the color it is good practice.

Hope this helps :)
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,559
#3: Sep 21 '07

re: Links and Classes


Do it this way:
.sidebar a:link
Member
 
Join Date: Sep 2007
Posts: 47
#4: Sep 21 '07

re: Links and Classes


Ah, thanks for the help!

I thought I saw something about that, and tried it also. But I realize what I did wrong . . . I tried putting it inside the brackets instead of on the outside.

Sheesh, it's always something simple with me haha . . .

Thanks again for the help, both of you!
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,559
#5: Sep 21 '07

re: Links and Classes


Don't feel bad. When I was learning all this I did the same things. You get tense, in a hurry, and just don't notice things. Even now, I find it better to just step away from the computer and it'll come to me.
Newbie
 
Join Date: Jun 2007
Posts: 16
#6: Sep 21 '07

re: Links and Classes


Same, I still mess up linking my style sheet and im like ..... why isn't anything working?!?!?!?!??$#%!$!$! ... O ..... then I feel stupid
Member
 
Join Date: Sep 2007
Posts: 47
#7: Sep 21 '07

re: Links and Classes


haha, thanks . . . At least I know I'm not the only one then. It seems every time I try to update/upgrade with using different code . . . not even the simplest of things work for me. Same with you also, it seemed, :)
Reply