A
A
Alex_8x2020-04-27 17:07:05
css
Alex_8x, 2020-04-27 17:07:05

How to select second element with specific class using nth-of-type?

There is a certain layout of three child elements. Example https://codepen.io/Foxmind/pen/xxGYLZE

I need to select the second of two items with class item. Instead, the first one is chosen. Tell me, please, why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WapSter, 2020-04-27
@Alex_8x

Nothing will come of it. :nth-child :nth-of-type counts all elements of a common parent, regardless of class.
UPD :nth-of-type is tag specific and only counts elements with the tag it was applied to.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question