伪类

1,设置a标签

<body>
    <a href="#1">点击</a>
    
</body>

2,E:link

这是设置超链接a在未访问前的样式

a:link{
            color:red;
        }

设置成了红色

3,E:visited
这是设置超链接a在其链接地址已被访问过时的样式

a:visited{
            color: #ccc;
        }

设置成了灰色

4,E:hover
设置元素在其鼠标悬停时的样式

a:hover{
            color: blue;
        }

设置成了蓝色

5,E:active
设置元素在被用户激活
(在鼠标点击与释放之间发生的事件)时的样式

a:active{
color: green;
}
设置成了绿色
6,E:focus
先插入
<input type="search" autofocus>

.search:focus{
color:red;
outline:1px solid blue;
}
设置了边框颜色和字体颜色
7,E:nth-child(n)
匹配父元素的第n个子元素E
多个子元素的时候使用
8,E:nth-of-type(n)
匹配同类型中的第n个同级兄弟元素E
9,E:target
匹配相关URL指向的E元素

 

posted @ 2016-08-10 10:42  必以剑终  阅读(103)  评论(0编辑  收藏  举报