欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

 

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中的伪类选择器如下:

状态伪类选择器

1link

2visited

3hover

4active

5focus

6lang

7target

结构性伪类选择器

1first-letter

2first-line

3before

4after

5root()

6not()

7empty()

8target()

9first-child()

10nth-child()

11nth-last-child()

12nth-of-typen

13only-child

14first-letter

15first-line

16before

17after

18selection

UI状态元素伪类选择器

E:checked{attribute} 匹配所有用户界面(form表单)中处于选中状态的元素

E:enabled{attribute} 匹配所有用户界面(form表单)中处于可用状态的元素

E:disabled{attribute} 匹配所有用户界面(form表单)中处于不可用状态的元素

E::selection{attribute} 匹配元素中被用户选中或处于高亮状态的部分

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c30233.shtml