Grow your CSS skills. Land your dream job.

Select all items after 10th item

  • # March 8, 2011 at 12:01 pm

    Hiya,

    I’ve got an ordered list and would like to select all list items after the 10th one. Is there a way to do this with pure css with some kind of nth child selector or somethin similar?

    Cheers,

    emma

    # March 8, 2011 at 12:26 pm

    You would do this for your nth child selector:

    :nth-child(1n+11)

    # March 8, 2011 at 12:52 pm

    The 1 is a little redundant. This works too.
    :nth-child(n+11)

    # March 9, 2011 at 5:02 am

    Perfect, thanks both! :)

    # November 10, 2012 at 9:16 am

    ok guys… what if I want have a specific css every 3 elements (to do a :nth-child(3n+3)) but only after the eleventh element ?

    # November 10, 2012 at 9:33 am

    @bbnnt

    Something like this? It works but im not too sure its semantic, i bet there is a better way.

    li:nth-child(n+11):nth-child(3n+3) { }

    CodePen example:

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".