SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,630
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    li:nth-child(odd) a:hover

    Can I do that? It doesn't seem to be working.

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,740
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    why not use n+1 instead of 'odd'?

  3. #3
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,630
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Does it do the same thing? If so you think that would hover?

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,740
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    oops, actually, 2n+1. holiday tiredness.
    mathematically, it should do the same thing
    2n+1= 1,3,5,7,9,11,13,15... (n->0)

    I am thing the hover is NOT the problem ( as long as you have an anchor inside the LI!), so this would be an easier way to target those specific element using a shortcut ('odd') that may not be supported by some UA.


    if you are trying to do: li:nth-child(odd):hover , (no A) , well i am not sure that would work in Safari. Saf seems to act oddly about things like this.

  5. #5
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,630
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    I've never seen anything like that. What's the exact syntax look like?

    Each li is a dif rotation. One -10 and the next 10. On hover I spin it 360. Well I want it to end strait. Not the 10 degrees off. So the default is hover 370deg and I'm trying to target the every other to 350deg. I've only tried on my iPad. I don't do my best work there. Maybe ill have more luck in DW.

  6. #6
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,740
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    li:nth-child(2n+1) a:hover {your rules...}
    you could have a test declaration to make sure your rule is on target , something obvious like {color: pink;} if you get pink text then you know your rule is working , but maybe your trig is off (tho it appears correct to me)
    Last edited by Stevie D; Dec 7, 2012 at 06:57. Reason: Fixed unwanted smiley code

  7. #7
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,630
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    I blame it on the iPad. I neglected to put the id before it. So specificity prob. It works now. FYI both (odd) and (2n) worked to target every other li. I used odd as it has more meaning to me.

  8. #8
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,740
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    Glad to hear you got it all functioning. I thought it was odd that "odd" wasnt working ( see what I did there?) but sometime CSS3 shortcuts vary from UA to UA, so i figure I would suggest the much maligned longhand.


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
  •