-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path12-combinators.html
183 lines (165 loc) · 4.19 KB
/
12-combinators.html
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!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>CSS Concept - Combinators</title>
<style>
body {
background-color: antiquewhite;
}
h1 {
color: brown;
}
h2 {
color: green;
}
h3 {
color: blueviolet;
}
hr {
height: 5px;
background-color: black;
border-radius: 10px;
}
.descendant {
background-color: aquamarine;
padding: 10px;
}
.descendant p {
background-color: aliceblue;
color: blue;
}
.child {
background-color: aquamarine;
padding: 10px;
}
.child > p {
background-color: green;
color: white;
}
.adjacent-sibling {
background-color: aquamarine;
padding: 10px;
}
.adjacent-sibling + p {
background-color: green;
color: white;
text-align: center;
font-size: 18px;
}
.general-sibling {
background-color: aquamarine;
padding: 10px;
}
.general-sibling ~ p {
background-color: red;
color: white;
text-align: center;
font-size: 18px;
}
</style>
</head>
<body>
<h1>Combinators</h1>
<div class="descendant">
<h2>Descendant Selector (space)</h2>
<p>
The descendant selector matches all elements that are descendants of a
specified element.
</p>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<hr />
<div class="child">
<h2>Child Selector (>)</h2>
<p>
The child selector selects all elements that are the children of a
specified element.
</p>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<hr />
<div class="adjacent-sibling">
<h2>Sibling Selector (+)</h2>
<p>
The adjacent sibling selector selects all elements that are the adjacent
siblings of a specified element.
</p>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<p>Adjacent Sibling targeting on this paragraph</p>
<p>
But Here, Adjacent Sibling is not targeting on this paragraph because it
is not directly after another specific element
</p>
<hr />
<div class="general-sibling">
<h2>General Sibling Selector (~)</h2>
<p>
The general sibling selector selects all elements that are siblings of a
specified element.
</p>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil,
corporis.
</p>
</div>
<p>General Sibling targeting on this paragraph</p>
<p>
But Here, General Sibling is targeting on this paragraph too because it
selects all elements that are siblings of a specified element.
</p>
<hr />
</body>
</html>