Target element by id somewhere within an element targeted by id

gringogordo :

I'm trying to target an element by ID somewhere within an element which I have successfully targeted.

So this is the actual working CSS now:

#parentElement>div>div>div>#childElement {
  display: none;
}

I'm sure I must be having a bad day but what I really want to do, to make it a little more robust is just write CSS (not jQuery or JavaScript) to do the following:

for all #childElement within #parentElement apply { display: none; }.

Is this a straightforward bit of CSS?

focus.style :

If you want all #childElement within #parentElement apply { display: none; } just write

#parentElement #childElement { display: none; }

It will be enough.

But you should knew, id recommended to bu unique, used only once per page. Use class instead for children.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=368336&siteId=1