背景图像:for :visited links?

background-image: for :visited links?(背景图像:for :visited links?)
本文介绍了背景图像:for :visited links?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

是否可以将 background-image: 属性添加到访问的链接?

Is it possible to add the background-image: property to visited links?

 a.coolLinks:visited{
     background-image:url("http://www.ledr.com/colours/black.jpg");
}

谢谢

所以这似乎是一个安全漏洞,这就是它无法完成的原因.没有迹象表明浏览器阻止了这种 CSS 样式.

So it appears that this is a security vulnerability and this is why it cannot be done. There was no indication that the browsers were blocking this css style.

推荐答案

根据大多数规范,您的代码是正确的.但是,许多浏览器会考虑访问链接上的背景图片可能侵犯用户隐私,所以他们不允许这样做.

Your code is correct according to most specifications. However, many browsers consider background images on visited links a potential violation of user's privacy, so they do not allow it.

观察这个例子:

<p><a href="/unvisited">Unvisited link</a></p>

<p><a href="http://jsfiddle.net/">Visited Link</a></p>

<style>
a {
  background:red url("http://placekitten.com/100/101?image=2") center center no-repeat;
  display: block;
  height: 200px;
  width: 200px;
  overflow: hidden;
  text-align: center;
  background-color: red;
}

a:visited {
  background:blue url("http://placekitten.com/100/100?image=1") center center no-repeat;
}
</style>

(也位于 http://jsfiddle.net/Yq5GY/1/).Firefox 忽略访问链接的背景图像声明,并且从不显示独奏小猫.您可以使用背景颜色进行一些区分.无论如何,仅依赖图像的可用性很差.

(Also at http://jsfiddle.net/Yq5GY/1/). Firefox ignores the background image declaration for visited links, and never displays the solo kitten. You can do some differentiation with background color. It's bad usability to rely on images alone, anyhow.

这篇关于背景图像:for :visited links?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to find a User ID from a Username in Discord.js?(如何从 Discord.js 中的用户名中查找用户 ID?)
Discord js reaction not detected(未检测到 Discord js 反应)
Joining a voice channel on ready (discord.js)(准备好加入语音频道(discord.js))
Cannot read properties of undefined when it shouldn#39;t be undefined in discord.js command handler(当不应该在 discord.js 命令处理程序中未定义时,无法读取未定义的属性)
Why messageReactionAdd do nothing discord.js(为什么 messageReactionAdd 什么都不做 discord.js)
How do I list all Members with a Role In Discord.Js(如何在 Discord.Js 中列出所有具有角色的成员)