Supose I have a dom structure I can't control (i.e. is generated).
<div>
... more dom here ...
<span>
... more dom here ....
<span>
... more dom here ...
</span>
... more dom here...
</span
... more dom here ...
</div>
The fact is that I represented this structure as 3-leveled but it could have many levels: the first span is not direct child of the div, but a descendant, and the second span is not necesarily children of the first span, but a descendant.
Also, since there are many structures I can't control, there are perhaps more levels: more nested span tags.
My question is:
- How can I reach -with CSS- ONLY the last
span
level? This means: everydiv span
not having anyspan
descendants. - How can I reach -with CSS- ONLY the first
span
level? This means: everydiv span
not having anyspan
in the dom path between the (expected) last span and the div.
I use jQuery for those selectors but since the code is dynamic and more components could appear, I cannot use jQuery code to filter what I expect and apply styles.