Targeting First 2 Children Or Last 2 Children February 27, 2024 Post a Comment I know a bunch of the pseudo classes (first-child, last-child, nth-child) but I am having trouble selecting the first 2 children in a list or the last 2, the list is dynamic and chSolution 1: For the first two children you can use: ulli:nth-child(-n + 2) { color: orange; } Copyhttp://jsfiddle.net/nYnSz/1/For the last two:ulli:nth-last-child(-n + 2) { color: orange; } Copyhttp://jsfiddle.net/nYnSz/ Share Post a Comment for "Targeting First 2 Children Or Last 2 Children"
Post a Comment for "Targeting First 2 Children Or Last 2 Children"