How can I hide an item that does not have a CSS ID?

advertisements

I am in trouble with a quite specific problem: I am using a portal that doesn't allow me to work on the static html, but only on the CSS.

I need to hide an element that is not declared with an id and so I cannot use

#nameOfTheElement {display:none;}.

Here is how the element looks in the html:

<div class="notToBeHidden">
<label class="label aClassToBeHidden" for="aClassToBeHidden">
<div class="forminput aClassToBeHidden">
</div>

Can someone help me understand how to hide this from the CSS, or if it's even possible?

Unfortunately, I cannot hide every element that uses the specific class because every other is needed even in the same page, I'd rather need to hide the "label class" and the "div class".

Thanks everyone!


If it is always in the same position on the page, you could use label.aClassToBeHidden:nth-child(7) for the label (if it is the seventh such label), and div.aClassToBeHidden:nth-child(7) for the div, giving:

label.aClassToBeHidden:nth-child(7),
div.aClassToBeHidden:nth-child(7) {
    display: none;
}