471,627 Members | 1,106 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

Links and Classes

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. }
  9. a.sidebar:link {color:white;}
  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!

Sep 21 '07 #1
6 1159
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 :)
Sep 21 '07 #2
7,435 Expert 4TB
Do it this way:
.sidebar a:link
Sep 21 '07 #3
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!
Sep 21 '07 #4
7,435 Expert 4TB
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.
Sep 21 '07 #5
Same, I still mess up linking my style sheet and im like ..... why isn't anything working?!?!?!?!??$#%!$!$! ... O ..... then I feel stupid
Sep 21 '07 #6
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, :)
Sep 21 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Emile van Sebille | last post: by
7 posts views Thread by Will Hartung | last post: by
2 posts views Thread by Fabrizio | last post: by
4 posts views Thread by Paul | last post: by
15 posts views Thread by Roedy Green | last post: by
2 posts views Thread by Hakan Fatih YILDIRIM | last post: by
reply views Thread by Gabriel Genellina | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.