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.
source
share