I have a WordPress-Website and want to edit the css of a specific site (generated from a plugin).
The problem is, I want to remove (display: none
) a header (h2). But the h2 doesn’t have a class (and because it isn’t the only h2, I cannot display: none
all the h2), so I cant select it with CSS. Is there a way to select something without a class?
2
Answers
There is indeed! find an element above it in the DOM which you CAN select, like a container with a classname, and use a selector. For example, if you have:
Then use something like:
However, if you are using something like Elementor on your site, then you can just remove the H2 in some other way, or even add a class name to it.
Yes, you can do this with selectors like nth-child() …
For example, suppose you want to make the second h2 tag red. This solution will be useful when there is no class name.