Any way to write "*: nth-child (2)" in CSS?

I need to hide the second child element div ( #parentDiv) irrespective of html-tag p, h2, h3or div.

I could write all the possible combinations in CSS, but it seemed awkward, since the element’s html tag here can change and is unpredictable. Therefore, I assume that writing all HTML tags is not a good approach.

Therefore, I tried to use a generic approach in CSS, but did not work.

#parentDiv *:nth-child(2) {
   display: none;
}

I do not need a JavaScript solution.

+4
source share
1 answer

The code looks good and great. Check the brackets. You may have forgotten to close the brackets.

+2
source

Source: https://habr.com/ru/post/1598808/


All Articles