小编Nic*_*k_g的帖子

样式兄弟选择器与:访问

当用户将鼠标悬停在链接上时,我正在显示图像元素 - 这是有效的.

我现在想让用户在返回网站时始终可以看到该图片...由于对被访问选择器的限制,我的下面尝试(我认为)被挫败了.

有没有办法解决这些限制,使这种方法有效?我可以使用另一个选择器来达到同样的效果吗?

a {
  text-decoration: underline;
  color: black;
}

#image {
  position: absolute;
  visibility: hidden;
  top: 30%;
  left: 60%;
}

a:visited {
  color: red;
}

a:visited + #image {
  visibility: visible;
}

a:hover{
  color: white;
  transition: color .3s ease;
}

a:hover + #image{
  visibility: visible;
}
Run Code Online (Sandbox Code Playgroud)

html css visited

6
推荐指数
1
解决办法
230
查看次数

标签 统计

css ×1

html ×1

visited ×1