Why nth-child doesn't work?

Why nth-child doesn't work?
0

#1

here is pen: [ http://codepen.io/ustvarno/pen/VjPQdY ]
line 160 and 163 set nth-child, but doesn’t work
my class “scroll-buttons” is three buttons at the top, left,right, add


#2

What are you trying to select? :nth-child doesn’t take constants.


#3

Use .scroll-buttons button:nth-child(1) instead of .scroll-buttons:nth-child(1). :nth-child doesn’t search for children, but checks if the preceeding element is the nth-child of its parent.


#4

I was trying to make border radius different on first and third child of my class (for buttons)


#5

:first-child and :last-child should work better here.


#6

It doesn’t work yet, even with first-child and last-child
line 160, 163


#7

See my response. You can than also use :first-child and :last-child.


#8

solved. I was thiking class > nth-child(1) will refer to first child of that class
solution was class > element > nth-child(1) || first-child
i didn’t understand your answer but now yes @BenGitter

doesn’t search for children, but checks if the preceeding element is the nth-child of its parent.