SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS Adjacent Sibling

    Hello

    I have this peice of code:

    HTML Code:
    <div>
    <a>Link</a>
    </div>
    
    <div>
    <a class=selected>Link</a>
    </div>
    
    <div>
    <a>Link</a> <!-- I want to style this one -->
    </div>
    How do I style the div AFTER the one with the .selected class
    I do not wish to apply the selected class to the div, I would like to keep it on the link.

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,734
    Mentioned
    31 Post(s)
    Tagged
    1 Thread(s)
    you cant.

    you need to give the class to the div rather than the anchor. ( so you will need to change all your existing style rules to .current a first)
    then you can do .current +div a{}

    incidentally , you probably could make this a list (use UL/LI) instead of divs.

    hope that helps


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
  •