Why nth-child doesn't work?

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

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

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.

1 Like

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

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

1 Like

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

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

1 Like

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.