Links and Classes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Michael7
    New Member
    • Sep 2007
    • 47

    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:
    Code:
    .sidebar {
    position:       absolute;
    width:          165px;
    top:            0px;
    left:           5px;
    border-right:	1px solid;
    }
    
    a.sidebar:link {color:white;}
    
    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,

    Code:
    <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
  • Bruno43
    New Member
    • Jun 2007
    • 16

    #2
    Try this

    Code:
    .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 :)

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      Do it this way:
      .sidebar a:link

      Comment

      • Michael7
        New Member
        • Sep 2007
        • 47

        #4
        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!

        Comment

        • drhowarddrfine
          Recognized Expert Expert
          • Sep 2006
          • 7434

          #5
          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.

          Comment

          • Bruno43
            New Member
            • Jun 2007
            • 16

            #6
            Same, I still mess up linking my style sheet and im like ..... why isn't anything working?!?!?!?! ??$#%!$!$! ... O ..... then I feel stupid

            Comment

            • Michael7
              New Member
              • Sep 2007
              • 47

              #7
              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, :)

              Comment

              Working...