With CSS selectors, is it possible to select elements with an attribute value that is the same as the attribute value of another specified element? For example:
<a class="important" href="foo.bar"></a>
will always appear on the page, but the href
might be anything. Then further on the page may be something like this:
<li>
<a href="bar.foo"></a>
<a href="foo.bar"></a>
<a href="bar.bar"></a>
<a href="foo.bar"></a>
</li>
This list again may contain anything but could contain <a>
elements with the same href="foo.bar"
.
I want to be able to select those <a>
elements within the list that have an href
attribute that matches the href
attribute of any <a class="important">
Is this possible with CSS alone? I know this could of course be done in javascript by making sure those specific <a>
elements within the list are created with a class attribute, but I'm interested in if there is a purely CSS solution.