-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17.Nth-Child-Selector.html
More file actions
87 lines (77 loc) · 1.91 KB
/
17.Nth-Child-Selector.html
File metadata and controls
87 lines (77 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nth - Child Selector</title>
<style>
p {
font-size: 1.5em;
}
ul {
font-size: 1.5em;
list-style-type: none;
}
/* n = 0 b = 0 , 0 , 2,4,6,8,10 */
ul li:nth-child(2n) {
color:red;
}
ul li:nth-child(2n + 1) {
color: blue;
}
ul li:nth-child(n + 4) {
background: black;
}
p:first-child {
background: blue;
}
p:last-child {
background: blue;
color: red;
}
p:nth-child(1) {
color: red;
}
p:nth-child(3) {
color: blue;
}
p:nth-child(even) {
color: red;
}
p:nth-child(odd) {
color: blue;
}
/* an + b -> n = 0, b = 0 */
</style>
</head>
<body>
<ul>
<li>Element</li>
<li>Element</li>
<li>Element</li>
<li>Element</li>
<li>Element</li>
<li>Element</li>
<li>Element</li>
<li>Element</li>
<li>Element</li>
<li>Element</li>
</ul>
<!-- <p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nemo, impedit.
</p>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nemo, impedit.
</p>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nemo, impedit.
</p>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nemo, impedit.
</p>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nemo, impedit.
</p> -->
</body>
</html>