Conditional visibility based on parent div

I am looking for a way to toggle a divs visibility, based on the ID or class of the parent div it is nested in. Does anybody know of a way to do this?

So if “div-child” is inside “div-parent#a” it is visible, but not if it is in “div-parent#b”

Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Hi Dennis!

What trigger do you have in mind for the visibility to show or hide? Like an on page load for example?