Cannot change the content of visited :before pseudo-elements

痴心易碎 提交于 2019-11-29 10:38:55

The allowed (= not ignored) CSS properties of visited links are color, background-color, border-*-color, outline-color and, column-rule-color (more under certain circumstances).

This is to prevent history stealing attacks. See this article for further details.

So you can, technically, set a :before pseudo class for :visited links, but it will be ignored and appears as if the links are not visited. This is not a bug, it's a feature ;)

There is a very limited range of possibilities for styling :visited links in modern browsers for privacy reasons – so that you couldn't detect which sites the user has visited before by checking the computed style with javascript.

The allowed properties for styling for :visited links is

  • color
  • background-color
  • border-color (and its sub-properties)
  • outline-color
  • The color parts of the fill and stroke properties

Even so, you cannot get the values of the computed style for visited links via javascript.

You can read more about it here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!