Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial2 Answers
Evans Owino
24,888 PointsIt looks like it's not a CSS selector as its not on this list: https://www.w3schools.com/css/css_pseudo_classes.asp
It seems to be simply a jQuery selector: https://www.w3schools.com/jquery/sel_even.asp
The equivalent selector in CSS would be (however this starts counting from 1 unlike the jQuery version):
li:nth-child(even) {
background-color: red
}
Evans Owino
24,888 PointsHi,
Here is the link: http://api.jquery.com/not/
As per the description, given the following list:
<ul>
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
<li>list item 4</li>
<li>list item 5</li>
</ul>
The following method call will select 2 and 4 and set their background color to red. This may seem strange at first but :even and :odd use 0-based indexing.
$( "li" ).not( ":even" ).css( "background-color", "red" );
Vic Mercier
3,276 PointsIt's a CSS property?