Apply effect of a pseudo class to all members of a class
I want to apply something like this
a:visited{background-color:#0F0;}
to all <a>
tags, if at least one of them has been 开发者_开发技巧clicked.
I know how to do it using JavaScript, but is there a pure CSS version?
I doesn't have to be <a>
or :visited
, I just want to highlight all occurrences with a certain tag or class if just one of them gets selected/hovered.
I'm not too clear on the effect you want, and why you want it, but there's no way to do this with CSS, you're stuck using javascript :(
As I understand, you want to style all <a>
tags if one has been hovered or clicked? Why not just make that the default style, it will probably only take 2 seconds until that happens.
精彩评论