Commit 2cdcb0d 1 parent daa135a commit 2cdcb0d Copy full SHA for 2cdcb0d
File tree 1 file changed +42
-1
lines changed
1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change 3
3
> 写了那么多的伪类选择器,有必要总结一下
4
4
5
5
### ` :root `
6
+
7
+ 顾名思义 root 元素就是 html 元素
8
+
6
9
### ` E:nth-child(n) `
10
+
11
+ E 元素不是其父元素的第 n 个子元素
12
+
7
13
### ` E:nth-last-child(n) `
14
+
15
+ E 元素是其父元素的倒数第 n 个子元素
16
+
17
+ ` p:nth-last-child(1) ` 同 ` p:last-child `
18
+
8
19
### ` E:nth-of-type(n) `
20
+
21
+ 属于父元素的特定类型的第 n 个子元素的每个元素
22
+
9
23
### ` E:nth-last-of-type(n) `
24
+
25
+ 属于父元素的特定类型的倒数第 n 个子元素的每个元素
26
+
10
27
### ` E:first-child `
28
+
29
+ 第一个子元素 同 ` E:nth-child(1) `
30
+
11
31
### ` E:last-child `
12
- ### ` :first-of-type `
32
+
33
+ 最后一个子元素 同 ` E:nth-last-child(1) `
34
+
35
+ ### ` E:first-of-type `
36
+
37
+ 第一个子类型 同 ` E:nth-of-type(1) `
38
+
13
39
### ` E:last-of-type `
40
+
41
+ 最后一个子类型 同 ` E:nth-last-of-type(1) `
42
+
14
43
### ` E:only-child `
44
+
45
+ E是其父元素的唯一子元素
46
+
15
47
### ` E:only-of-type `
48
+
49
+ E是其父元素的特定类型的唯一子元素
50
+
51
+ ### 关于 child 和 type
52
+
53
+
54
+
16
55
### ` E:empty `
56
+
57
+
17
58
### ` E:lang(en) `
18
59
### ` E:not(exception) `
19
60
### ` ::before `
You can’t perform that action at this time.
0 commit comments