Skip to content Skip to sidebar Skip to footer

Combining Multiple Pseudo-selectors

It appears that at one point in time combining multiple pseudo-selectors was possible. For example, one could do this: a:visited:hover {color: red} A quick Google search reveals mu

Solution 1:

The :visited pseudoclass can't be used for most styling in a lot of modern browsers anymore because it's a security hole. See this link for a more formal discussion on it.

The short version is that if you can style :visited links differently, you can use that to determine if people have visited various sites, and therefore target them based on their browser history. Most modern browsers therefore heavily restrict the styling that can be done on them.

You can still chain pseudoselectors. For example, a:focus:hover works just fine to apply styles only if the element is focused AND hovered. See this link for a demonstration.

Post a Comment for "Combining Multiple Pseudo-selectors"