Just a quick one if anyone would be so kind. I'm baffled as to why I sometimes need to use an ancestor selector in order to effectively target a CSS class.
For instance, if I'm trying to hide an element with class .mobile-hide
in a media query stylesheet:
<div id="container">
<div id="parent">
<div id="child1" class="social-icon">Facebook</div>
<div id="child2" class="social-icon mobile-hide">Twitter (Hide Me)</div>
<div id="child3" class="social-icon">Instagram</div>
</div>
</div>
When I use simply:
.mobile-hide { display:none; }
in my stylesheet it does nothing. But when I use:
#container .mobile-hide { display:none; }
it works as expected and I cannot understand why.