在css中,选择器是一种模式,用于选择需要添加样式的元素
Css选择器可以分为以下几种:
1. Id选择器 #box {}
2. 类选择器 .box {}
3. 标签选择器 a {}和 a, h1, p {}
4. 相邻选择器 h1+p {}
5. 子选择器 ul>li {}
6. 后代选择器 li a {}
7. 通配符选择器 * {} 和 * a{}
8. 属性选择器 a[rel=”external”] {}
9. 伪类选择器 a:hover{}
CSS3中的伪类选择器如下:
状态伪类选择器
1:link
2:visited
3:hover
4:active
5:focus
6:lang
7:target
结构性伪类选择器
1:first-letter
2:first-line
3:before
4:after
5:root()
6:not()
7:empty()
8:target()
9:first-child()
10:nth-child()
11:nth-last-child()
12:nth-of-type(n)
13:only-child
14:first-letter
15:first-line
16:before
17:after
18:selection
UI状态元素伪类选择器
E:checked{attribute} 匹配所有用户界面(form表单)中处于选中状态的元素
E:enabled{attribute} 匹配所有用户界面(form表单)中处于可用状态的元素
E:disabled{attribute} 匹配所有用户界面(form表单)中处于不可用状态的元素
E::selection{attribute} 匹配元素中被用户选中或处于高亮状态的部分
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c30233.shtml