You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: curriculum/challenges/english/25-front-end-development/quiz-css-pseudo-classes/66ed9002f45ce3ece4053eb6.md
+69-30Lines changed: 69 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,13 +33,13 @@ They are selector used to add movement effects to an element during interactions
33
33
34
34
#### --answer--
35
35
36
-
They are keywords added to a selector that change how an element looks or behaves when it's in a specific state.
36
+
They are keywords added to a selector that style an element based on its state.
37
37
38
38
### --question--
39
39
40
40
#### --text--
41
41
42
-
Which pseudo-class applies when you hover over an element?
42
+
Which pseudo-class applies when a pointing device is being positioned over an element?
43
43
44
44
#### --distractors--
45
45
@@ -83,7 +83,7 @@ Which pseudo-element allows you to style the first letter of a paragraph?
83
83
84
84
#### --text--
85
85
86
-
Which pseudo-class changes the style of an element when you click on it?
86
+
Which pseudo-class changes the style of an element while it is being clicked?
87
87
88
88
#### --distractors--
89
89
@@ -105,7 +105,7 @@ Which pseudo-class changes the style of an element when you click on it?
105
105
106
106
#### --text--
107
107
108
-
Which pseudo-class is used to select and style an element when it's focused?
108
+
Which pseudo-class is used to style an element when it is ready to receive user input, such as a text field being clicked or tabbed into?
109
109
110
110
#### --distractors--
111
111
@@ -127,29 +127,45 @@ Which pseudo-class is used to select and style an element when it's focused?
127
127
128
128
#### --text--
129
129
130
-
What does the `:hover` pseudo-class do?
130
+
Which of the following CSS rules correctly adds the text `Note:` in front of each paragraph element with a class of `note`?
131
131
132
132
#### --distractors--
133
133
134
-
It styles your element when you click on it.
134
+
```css
135
+
.note::before {
136
+
content: "Note:";
137
+
}
138
+
```
135
139
136
140
---
137
141
138
-
It makes your element float around the screen.
142
+
```css
143
+
p.note::after {
144
+
content: "Note:";
145
+
}
146
+
```
139
147
140
148
---
141
149
142
-
It hides elements on click.
150
+
```css
151
+
p::before {
152
+
content: "Note:";
153
+
}
154
+
```
143
155
144
156
#### --answer--
145
157
146
-
It styles an element when you hover over it.
158
+
```css
159
+
p.note::before {
160
+
content: "Note:";
161
+
}
162
+
```
147
163
148
164
### --question--
149
165
150
166
#### --text--
151
167
152
-
Which pseudo-class is used for an input field that is checked?
168
+
Which pseudo-class applies to an input field when it is selected or toggled on?
153
169
154
170
#### --distractors--
155
171
@@ -209,7 +225,7 @@ li:last-child {
209
225
210
226
#### --text--
211
227
212
-
Which pseudo-class applies when an input field is optional?
228
+
Which pseudo-class targets input fields that are not required to fill out?
213
229
214
230
#### --distractors--
215
231
@@ -253,7 +269,7 @@ It styles elements that are not available for user interaction.
253
269
254
270
#### --text--
255
271
256
-
Which pseudo-class is triggered when a form input is valid?
272
+
Which pseudo-class applies when a form input meets its validation criteria?
257
273
258
274
#### --distractors--
259
275
@@ -283,7 +299,7 @@ Which one of these is not a location pseudo-class?
283
299
284
300
---
285
301
286
-
`:scope`
302
+
`:any-link`
287
303
288
304
---
289
305
@@ -335,23 +351,41 @@ li:nth-child(3) {
335
351
336
352
#### --text--
337
353
338
-
Which pseudo-class is used for the current active link?
354
+
Which elements will have a `color` of `blue` with the following CSS?
355
+
356
+
```css
357
+
p:is(.blue, .highlight) {
358
+
color: blue;
359
+
}
360
+
```
339
361
340
362
#### --distractors--
341
363
342
-
`:focus`
364
+
```html
365
+
<pclass="class">Paragraph 1</p>
366
+
<pclass="highlight">Paragraph 2</p>
367
+
```
343
368
344
369
---
345
370
346
-
`:hover`
371
+
```html
372
+
<divclass="blue">Paragraph 1</div>
373
+
<divclass="highlight">Paragraph 2</div>
374
+
```
347
375
348
376
---
349
377
350
-
`:visited`
378
+
```html
379
+
<p>Paragraph 1</p>
380
+
<spanclass="highlight">Paragraph 2</span>
381
+
```
351
382
352
383
#### --answer--
353
384
354
-
`:active`
385
+
```html
386
+
<pclass="blue">Paragraph 1</p>
387
+
<pclass="highlight">Paragraph 2</p>
388
+
```
355
389
356
390
### --question--
357
391
@@ -379,23 +413,29 @@ It selects elements that do not match a given selector.
379
413
380
414
#### --text--
381
415
382
-
What does the `:nth-child(4)` pseudo-class do?
416
+
What does the following CSS rule do?
417
+
418
+
```css
419
+
p:first-of-type {
420
+
font-style: italic;
421
+
}
422
+
```
383
423
384
424
#### --distractors--
385
425
386
-
It selects the last child.
426
+
It selects the first `p` element in the document.
387
427
388
428
---
389
429
390
-
It selects all children.
430
+
It selects all `p` elements in the document.
391
431
392
432
---
393
433
394
-
It styles odd children.
434
+
It selects the first child of every `p` element.
395
435
396
436
#### --answer--
397
437
398
-
It selects the fourth child.
438
+
It selects the first `p` element within a parent container.
399
439
400
440
### --question--
401
441
@@ -405,19 +445,19 @@ What does the `:last-of-type` pseudo class do?
405
445
406
446
#### --distractors--
407
447
408
-
It selects the first child element.
448
+
It selects the first child element of a specific type within its parent.
409
449
410
450
---
411
451
412
-
It selects the middle element.
452
+
It selects the middle child element of a specific type within its parent.
413
453
414
454
---
415
455
416
-
It selects every element in a group.
456
+
It selects every child element of a specific type within its parent.
417
457
418
458
#### --answer--
419
459
420
-
It selects the last sibling element.
460
+
It selects the last child element of a specific type within its parent.
421
461
422
462
### --question--
423
463
@@ -453,7 +493,7 @@ Which one of these is a functional pseudo-class?
453
493
454
494
---
455
495
456
-
`:last-of-type`
496
+
`:match()`
457
497
458
498
---
459
499
@@ -483,5 +523,4 @@ Which one of these is not a functional pseudo-class?
Copy file name to clipboardExpand all lines: curriculum/challenges/english/25-front-end-development/review-css-pseudo-classes/671a907bad4538752765f2ff.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,8 @@ Review the concepts below to prepare for the upcoming quiz.
38
38
-**`:link` Pseudo-class**: This pseudo-class allows you to target all unvisited links on a webpage. You can use it to style links differently before the user clicks on them.
39
39
-**`:local-link` Pseudo-class**: This pseudo-class targets links that point to the same document. It can be useful when you want to differentiate internal links from external ones.
40
40
-**`:visited` Pseudo-class**: This pseudo-class targets a link the user has visited.
41
-
-**`:target` Pseudo-class**: This pseudo-class is used to apply styles to an element that is the target of a URL fragment
41
+
-**`:target` Pseudo-class**: This pseudo-class is used to apply styles to an element that is the target of a URL fragment.
42
+
-**`:target-within` Pseudo-class**: This pseudo-class applies styles to an element when it or one of its descendants is the target of a URL fragment.
42
43
43
44
## Tree-structural Pseudo-classes
44
45
@@ -48,14 +49,13 @@ Review the concepts below to prepare for the upcoming quiz.
48
49
-**`:nth-child(n)` Pseudo-class**: This pseudo-class allows you to select elements based on their position within a parent.
49
50
-**`:nth-last-child(n)` Pseudo-class**: This pseudo-class enables you to select elements by counting from the end.
50
51
-**`:first-child` Pseudo-class**: This pseudo-class selects the first element in a parent element or the document.
51
-
-**`:last-child` Pseudo-class**: This pseudo-class selects the last element in a parent element or the document
52
-
-**`:only-child` Pseudo-class**: This pseudo-class selects the only element in a parent element or the document
52
+
-**`:last-child` Pseudo-class**: This pseudo-class selects the last element in a parent element or the document.
53
+
-**`:only-child` Pseudo-class**: This pseudo-class selects the only element in a parent element or the document.
53
54
-**`:first-of-type` Pseudo-class**: This pseudo-class selects the first occurrence of a specific element type within its parent.
54
55
-**`:last-of-type` Pseudo-class**: This pseudo-class selects the last occurrence of a specific element type within its parent.
55
56
-**`:nth-of-type(n)` Pseudo-class**: This pseudo-class allows you to select a specific element within its parent based on its position among siblings of the same type.
56
57
-**`:only-of-type` Pseudo-class**: This pseudo-class selects an element if it's the only one of its type within its parent.
57
58
58
-
59
59
## Functional Pseudo-classes
60
60
61
61
-**Functional Pseudo-classes**: Functional pseudo-classes allow you to select elements based on more complex conditions or relationships. Unlike regular pseudo-classes which target elements based on a state (for example, :hover, :focus), functional pseudo-classes accept arguments.
@@ -91,6 +91,14 @@ article:has(h2) {
91
91
}
92
92
```
93
93
94
+
-**`:not()` Pseudo-class**: This pseudo-class is used to select elements that do not match the provided selector.
95
+
96
+
```css
97
+
p:not(.example) {
98
+
color: blue;
99
+
}
100
+
```
101
+
94
102
## Pseudo-elements
95
103
96
104
-**`::before` Pseudo-element**: This pseudo-element uses the `content` property to insert cosmetic content like icons just before the element.
0 commit comments