SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Multiple IDs

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2010
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple IDs

    I would like to have multiple id and all using hover link for all

    #test1, #test2, #test3, #test4 a:hover{
    color:#0F0;
    }

    this doesn't work. NOT sure why??
    thanks

  2. #2
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    post the html that goes with the css

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    That code is equivalent to

    #test1{
    color:#0F0;
    }
    #test2{
    color:#0F0;
    }
    #test3{
    color:#0F0;
    }
    #test4 a:hover{
    color:#0F0;
    }

    So which of those is it that isn't working?
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Enthusiast Adam Chrapkowski's Avatar
    Join Date
    Sep 2011
    Location
    Poland
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As felgall has been written there are four separate rules. I guess that you expecting it is the same like:
    Code:
    #test1 a:hover {
      color:#0F0
    }
    
    #test2 a:hover {
      color:#0F0;
    }
    
    #test3 a:hover {
      color:#0F0;
    }
    
    #test4 a:hover {
      color:#0F0;
    }
    To do that you need to expand every selector:
    Code:
    #test1 a:hover, #test2 a:hover, #test3 a:hover, #test4 a:hover {
      color:#0F0;
    }
    or add to each a class, for example test:
    Code:
    .test a:hover {
      color:#0F0;
    }


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
  •