Sorry if this sounds pretty basic to those who follow the css tag.
The webpage in question has multiple sections:
<section id="top"> ; <section id="tab-banner">
Within these sections there is much html with many levels of nesting.
I just want to say grab all <a>
tags that are descendants of each section. E.g.
#tab-banner a { /* css here */ }
How do I say grab all elements of a certain type (a) that are descendents of elements with specific IDs?
For all descendants, use:
#tab-banner *
For direct descendants, use:
#tab-banner > *
As the op changed/clarified the question:
To find all descendants of a specific type, just use that type instead of *
. Example:
#tab-banner a
So, what you are trying is correct. If the style doesn't apply to the elements that you expect, then those elements are actually not descendants of that section, or you have another rule that takes prescedence.
Sounds like you might need the Universal selector, but I'd suggest you were more specific in how you attach your css
#tab-banner * {css here}
the star selector will append the styles to all the decendants but this isn't best practice as it has performance effects
Universal_selectors
for more help checkout this helpful article The 30 CSS Selectors you Must Memorize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With