Combining multiple pseudo selectors

It seems that at one point in time it is possible to combine several pseudo-selectors. For example, this can be done:

a:visited:hover {color: red}

A quick Google search shows several examples of this in action, here , here and here . I cannot get this feature to work in the latest versions of Safari, Firefox or Chrome. Can someone explain why this function regressed and / or was disabled?

+6
source share
1 answer

The :visited pseudo :visited can no longer be used for most styles in many modern browsers because it is a security hole. See this link for a more formal discussion of this issue.

A short option is that if you can style the :visited links in different ways, you can use this to determine if people visit different sites and, therefore, target them based on their browser history. Therefore, most modern browsers greatly limit the style that can be done on them.

You can still connect pseudo selectors. For example, a:focus:hover works great to apply styles only if the element is focused and freezes. See this link for a demo.

+11
source

Source: https://habr.com/ru/post/900869/


All Articles