Issue
Say for instance I have the following HTML
<ul>
<li><a href="a">A</a></li>
<li><a href="b">B</a></li>
<li class="myclass"><a href="c">C</a></li>
<li><a href="d">D</a></li>
<li><a href="e">E</a></li>
</ul>
Now I can detemine the next sibling to the li with the class="myclass" by using the following css .someclass + li {}. However if I wanted to apply a CSS rule to previous li, is it possible to do this using css rather than jQuery's $("#some-id").prevAll() or writing some JavaScript to find this?
I'm not that confident as I've never heard of this and my searching hasn't provided a solution.
Thanks
Solution
Nope, in CSS you can't 'traverse' the dom structure. You can only inherit style definitions recursively.
Answered By - Richard Tuin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.