: Nth-child

Source: Internet
Author: User

Matches the nth child or odd and even element under its parent element

: the EQ (index) match selector Specifies the elements of the sequence, and this will match the child elements for each parent element.

: Nth-child starting from 1, and: Eq () is from 0! Available: <br>nth-child (even) <br>:nth-child (odd) <br>:nth-child (3n) <br>:nth-child (2) <br >:nth-child (3n+1) <br>:nth-child (3n+2)

To match the ordinal of an element, starting with 1

Example Description:

Find the 2nd Li in each UL

HTML Code:
<ul>  <li>John</li>  <li>Karl</li>  <li>Brandon</li></ul><ul>  <li>Glen</li>  <li>Tane</li>  <li>Ralph</li></ul>
JQuery Code:
$("ul li:nth-child(2)")
Results:
[ <li>Karl</li>,   <li>Tane</li> ]

: Nth-child

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.