Skip to content

Commit 2cdcb0d

Browse files
committed
add pseudo-class blog 🌟 🏖 👊
1 parent daa135a commit 2cdcb0d

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

Blog/63.CSS 伪类选择器 Pseudo-Classes.md

+42-1
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,58 @@
33
> 写了那么多的伪类选择器,有必要总结一下
44
55
### `:root`
6+
7+
顾名思义 root 元素就是 html 元素
8+
69
### `E:nth-child(n)`
10+
11+
E 元素不是其父元素的第 n 个子元素
12+
713
### `E:nth-last-child(n)`
14+
15+
E 元素是其父元素的倒数第 n 个子元素
16+
17+
`p:nth-last-child(1)``p:last-child`
18+
819
### `E:nth-of-type(n)`
20+
21+
属于父元素的特定类型的第 n 个子元素的每个元素
22+
923
### `E:nth-last-of-type(n)`
24+
25+
属于父元素的特定类型的倒数第 n 个子元素的每个元素
26+
1027
### `E:first-child`
28+
29+
第一个子元素 同 `E:nth-child(1)`
30+
1131
### `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+
1339
### `E:last-of-type`
40+
41+
最后一个子类型 同 `E:nth-last-of-type(1)`
42+
1443
### `E:only-child`
44+
45+
E是其父元素的唯一子元素
46+
1547
### `E:only-of-type`
48+
49+
E是其父元素的特定类型的唯一子元素
50+
51+
### 关于 child 和 type
52+
53+
54+
1655
### `E:empty`
56+
57+
1758
### `E:lang(en)`
1859
### `E:not(exception)`
1960
### `::before`

0 commit comments

Comments
 (0)