I have HTML looking something like this:
<ul>
<li>
<a></a>
<a></a>
<a></a>...
</li>
</ul>
I want to apply a style to all sibling links of the visited link. I tried:
ul>li>a:visited ~ a{
color: green !important;
}
And nothing happens. But
ul>li>a:first-child ~ a{
color: green !important;
}
works perfectly fine.
Applying a style to <li>
with a visited link works for me, too.
:visited
is restricted to some styles (developer.mozilla.org/en-US/docs/Web/CSS/…) - Temani Afif:visited
, along with limitations of which properties you can style, you can't target other elements other than the link itself, hence your first style doesn't work. - Asons