Home >Web Front-end >HTML Tutorial >About CSS3:nth-child() selector_html/css_WEB-ITnose
A page with many small squares. The class of the big square is big and the class of the small square is small. Use the css3 selector to write this:
.small:nth-child(even){margin-right:0;}
Through the guidance of other netizens , understand that selecting the odd-numbered or even-numbered child element from the parent element does not specify a certain type (.small), but all child elements are counted.
So the final solution is:
$(".small:odd").addClass("last");