SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone just confirm

    Can someone please confirm to me that the following:

    Code CSS:
    #navigation a:link, a:visited, a:active
    {
    color: #00ccff;
    text-decoration: none;
    font-weight: bold;
    }

    Will be applied to all links with an element with an id of navigation?



    If that is correct then why are some links whcih are not in my #navigation elemtn being set to the colour chosen above. I temporarily set the colour in the css code to "yellow" and the links in the navigation id and the ones outside are all turning yellow so I c=know it;s this bit of code up to no good!

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No. That will apply to unvisited links inside an element with id="navigation", and to all unvisited links and all active links (not only those in navigation).

    When you group selectors with commas, every selector is independent of the others. What you probably want is this:
    Code CSS:
    #navigation a:link, #navigation a:visited, #navigation a:active
    {
      color: #00ccff;
      text-decoration: none;
      font-weight: bold;
    }
    Birnam wood is come to Dunsinane

  3. #3
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In order to not forget to write any of the parents, I always write the selector on a separate line, like:

    Code css:
    #navigation a:link, 
    #navigation a:visited, 
    #navigation a:active
    {
      color: #00ccff;
      text-decoration: none;
      font-weight: bold;
    }
    Dan G
    Marketing Strategist & Consultant

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ^ So do I, usually.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent, Thanks for the help. That solved it. Now another confirmation please along a similar line:

    Does

    Code CSS:
    #content table tr th
    {
    whatever
    }

    Apply to just th's within a table row within a table whcih is in content?

    and...

    Does this:

    Code CSS:
    #navigation #status img

    Apply to images within an id of status whcih is in an id of navigation?

  6. #6
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Both yes, though you don't need the tr or table as th can only be placed there.
    Dan G
    Marketing Strategist & Consultant

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's likely that #navigation #status img can be simplified to #status img, too. Since an ID must be unique, there can be only one #status element on the page. Unless you have a #status element that resides within #navigation on some pages but not on others, you should be able to use the shorter selector.
    Birnam wood is come to Dunsinane


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
  •