CSS 伪类选择器

1 伪类选择器用于向某些选择器添加特许的效果。比如给连接添加特殊效果,比如可以选择第一个,第n个元素。

   链接伪类选择器:

    :link     未访问的连接  biy

    :visited 已访问的连接 点过的样子

    :hover  鼠标移动到链接上 鼠标经过链接时候的样子

    :active 选定的链接 鼠标按下时候的样子

  上面的顺序不能修改,否则无法生效

    

<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        a:link {  #未访问过的链接
            color:#3c3c3c;
        }
        a:visited {   #已经访问过的链接
            color:orange;
        }
        a:hover {    #鼠标经过链接时的样子
            color:#f10215;
        }
        a:active {    #鼠标按下时候的样子
            color:green; 
        }
    
    </style>
</head>
<body>
    <a href="http://www.baidu.com" target="_blink">百度</a>
</body>
</html>

实际开发中的伪类链接

<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        a {
           color:#333;
           text-decoration:none;
           font-size:25px;
           font-weight:700;
        } 
        a:hover {  #顺序不能颠倒
            color:green;
        }
    
    </style>
</head>
<body>
    <a href="http://www.baidu.com" target="_blink">百度</a>
</body>
</html>

 

posted @ 2018-07-05 18:05  会开车的好厨师  阅读(84)  评论(0)    收藏  举报