li:last-child:nth-child(even)

Last-child_nth-child-even

3 Responses

  1. Nathan Smith Nathan Smith

    I actually came across a situation where I legitimately needed to target the last [li] in a list, but only if it was even. This is a screenshot of that use-case.

    Example CSS selector...

    .item-stream li:last-child:nth-child(even) {
    /* Fade zebra-stripe to 0% opacity */
    }

    Note: This is faux data that we're using just to get a feel for varying character count, line-length, etc. The username "Yabox" and the causes being supported aren't "live."

    likes

    over 2 years ago

  2. Matthew Anderson Matthew Anderson

    Clever.

    over 2 years ago

  3. Micah Choquette Micah Choquette

    Gonna have to take note of that one. Thanks for sharing! Looks sharp, too.

    over 2 years ago

keyboard shortcuts: previous shot next shot L or F like