SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Shorter way of doing this?

    Code:
    .fullstory a:visited,
    .fullstory a:active,
    .fullstory a:hover,
    .fullstory a:link {
     color: black;
    }
    I tried:

    .fullstory a {
    color: black;
    }

    but it didn't work. What's the best way to do this?

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,478
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    It should work!

    The .fullstory a should refer to all states of the anchor.
    Code:
    <style>
    .fullstory a {
    color: black;
    }
    </style>
    </head>
    <body>
    <ul class="fullstory">
      <li><a href="#">link1</a></li>
      <li><a href="#">link2</a></li>
      <li><a href="#">link3</a></li>
      <li><a href="#">link4</a></li>
    </ul>
    I also note from your first example that you are defining the anchor states in the wrong order.

    You should define them in the order link, visited, hover, active.

    Paul

  3. #3
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's working in firefox, but not in IE...Grrr, is it meant to work in IE? Should I look for errors in other parts of my code?

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,478
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Hi,
    Should I look for errors in other parts of my code?
    Yes

    Have you defined more specific anchor styles somewhere else that are overriding these.

    Try the small snippet of code on a page on its own and you will see that it should work in ie.

    Try Changing the code to be more specific.
    Something like this:

    Code:
     <style>
    ul#fullstory li a {
    color: black;
    }
    </style>
    </head>
    <body>
    <ul id="fullstory">
      <li><a href="#">link1</a></li>
      <li><a href="#">link2</a></li>
      <li><a href="#">link3</a></li>
      <li><a href="#">link4</a></li>
    </ul>
    Paul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •