1. 动态选择器
概念: 动态选择器需要一些动作触发之后才会产生效果,如鼠标移动、获取焦点等。
| 选择器 | 描述 | 案例 | 版本 |
|---|---|---|---|
| :link | 未访问的超级链接 | a:link{} | 1 |
| :visited | 已访问的超级链接 | a:visited{} | 1 |
| :hover | 鼠标经过超级链接时 | a:hover{} | 2 |
| :active | 鼠标激活超级链接时 | a:active{} | 2 |
| :focus | 当获取焦点时 | input:focus{} | 2 |
2. 链接四大状态
布局:
我自己写的:默认是粉色(pink),鼠标过去的时候是黄色(yellow),鼠标点下去是红色(red),点完之后是紫色(purple)
<a href="http://www.baidu.com" target="_blank">百度</a>
样式:
a:link{
color:pink;
}
a:hover{
color:yellow;
}
a:active{
color:red;
}
a:visited{
color:purple;
}
3. :focus
布局:
我自己写的:焦点在哪个框内,哪个框就会显示CSS效果
<input type="text" />
<input type="text" />
样式:
input:focus{
border: 1px solid blue;
}