ITPub博客

首页 > 应用开发 > > visited伪类如何添加背景图

visited伪类如何添加背景图

作者:z_paul 时间:2019-08-02 15:39:38 0 删除 编辑

希望实现这样的效果,当一个链接被访问过后,链接区域出现一个特定背景图,以向用户突显其被访问过的特征。但是始终无法正确显示。

补充:如果将背景图挪到hover中可以看到背景图,但是放在visited中始终无效

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta   http-equiv="expires"   content="0">
    <meta   http-equiv="cache-control"   content="no-cache">
    <meta   http-equiv="pragma"   content="no-cache">
    <title>document</title>
    <style type="text/css">
        a{
            display: inline-block;
        }
        a:link{
            background-color: #0f0;
        }
        a:hover{
            text-decoration: none;
            border:1px solid #ccc;
            /*放置在hover中能看到*/
          /*background: url("images/ok1.png") no-repeat 0 0 ;*/
        }
        a:visited{
            text-decoration: none;       
            background: url("images/ok1.png") no-repeat 0 0 ;
           /* background-color: #00f;  */ /*背景色能看到*/   
        }
        .circle{
            width: 50px;
            height: 50px;
            border-radius: 50%;
            line-height: 50px;
            text-align: center;
        }
         
    </style>
</head>
<body>
    <div>This is a <a  href="#"  class="circle">link</a></div>
</body>


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/75/viewspace-3130674/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-17

  • 博文量
    151
  • 访问量
    6023