Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Jorne Moonen
Jorne Moonen
6,616 Points

More then one number in nth-child?

Is it possible to select multiply numbers with nth-child pseudo-class? For instance I would like to select item 3 and item 6.

        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
        <li>Item 4</li>
        <li>Item 5</li>
        <li>Item 6</li>
        <li>Item 7</li>
        <li>Item 8</li>
        <li>Item 9</li>
        <li>Item 10</li>        
li:nth-child(6, 3)  {
 background:  #52bab3;
  color: #fff ;

1 Answer

james south
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,258 Points

you can just make two selectors, one for 3 and one for 6

li:nth-child(3), li:nth-child(6)

or using negative numbers you can start at any item and go backwards toward the start, and just start at 6 and apply to every 3rd item, so it would be 6 and 3.