-
CSS Adjacent Sibling
Hello
I have this peice of code:
HTML Code:
<div>
<a>Link</a>
</div>
<div>
<a class=selected>Link</a>
</div>
<div>
<a>Link</a> <!-- I want to style this one -->
</div>
How do I style the div AFTER the one with the .selected class
I do not wish to apply the selected class to the div, I would like to keep it on the link.
-
you cant.
you need to give the class to the div rather than the anchor. ( so you will need to change all your existing style rules to .current a first)
then you can do .current +div a{}
incidentally , you probably could make this a list (use UL/LI) instead of divs.
hope that helps