Skip to content

Commit 5eb5b99

Browse files
moT01Sembauke
andauthored
fix(curriculum): CSS pseudo-classes quiz after audit (freeCodeCamp#58422)
Co-authored-by: Sem Bauke <[email protected]>
1 parent 70166a9 commit 5eb5b99

File tree

2 files changed

+81
-34
lines changed

2 files changed

+81
-34
lines changed

curriculum/challenges/english/25-front-end-development/quiz-css-pseudo-classes/66ed9002f45ce3ece4053eb6.md

Lines changed: 69 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ They are selector used to add movement effects to an element during interactions
3333

3434
#### --answer--
3535

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.
3737

3838
### --question--
3939

4040
#### --text--
4141

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?
4343

4444
#### --distractors--
4545

@@ -83,7 +83,7 @@ Which pseudo-element allows you to style the first letter of a paragraph?
8383

8484
#### --text--
8585

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?
8787

8888
#### --distractors--
8989

@@ -105,7 +105,7 @@ Which pseudo-class changes the style of an element when you click on it?
105105

106106
#### --text--
107107

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?
109109

110110
#### --distractors--
111111

@@ -127,29 +127,45 @@ Which pseudo-class is used to select and style an element when it's focused?
127127

128128
#### --text--
129129

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`?
131131

132132
#### --distractors--
133133

134-
It styles your element when you click on it.
134+
```css
135+
.note::before {
136+
content: "Note:";
137+
}
138+
```
135139

136140
---
137141

138-
It makes your element float around the screen.
142+
```css
143+
p.note::after {
144+
content: "Note:";
145+
}
146+
```
139147

140148
---
141149

142-
It hides elements on click.
150+
```css
151+
p::before {
152+
content: "Note:";
153+
}
154+
```
143155

144156
#### --answer--
145157

146-
It styles an element when you hover over it.
158+
```css
159+
p.note::before {
160+
content: "Note:";
161+
}
162+
```
147163

148164
### --question--
149165

150166
#### --text--
151167

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?
153169

154170
#### --distractors--
155171

@@ -209,7 +225,7 @@ li:last-child {
209225

210226
#### --text--
211227

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?
213229

214230
#### --distractors--
215231

@@ -253,7 +269,7 @@ It styles elements that are not available for user interaction.
253269

254270
#### --text--
255271

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?
257273

258274
#### --distractors--
259275

@@ -283,7 +299,7 @@ Which one of these is not a location pseudo-class?
283299

284300
---
285301

286-
`:scope`
302+
`:any-link`
287303

288304
---
289305

@@ -335,23 +351,41 @@ li:nth-child(3) {
335351

336352
#### --text--
337353

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+
```
339361

340362
#### --distractors--
341363

342-
`:focus`
364+
```html
365+
<p class="class">Paragraph 1</p>
366+
<p class="highlight">Paragraph 2</p>
367+
```
343368

344369
---
345370

346-
`:hover`
371+
```html
372+
<div class="blue">Paragraph 1</div>
373+
<div class="highlight">Paragraph 2</div>
374+
```
347375

348376
---
349377

350-
`:visited`
378+
```html
379+
<p>Paragraph 1</p>
380+
<span class="highlight">Paragraph 2</span>
381+
```
351382

352383
#### --answer--
353384

354-
`:active`
385+
```html
386+
<p class="blue">Paragraph 1</p>
387+
<p class="highlight">Paragraph 2</p>
388+
```
355389

356390
### --question--
357391

@@ -379,23 +413,29 @@ It selects elements that do not match a given selector.
379413

380414
#### --text--
381415

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+
```
383423

384424
#### --distractors--
385425

386-
It selects the last child.
426+
It selects the first `p` element in the document.
387427

388428
---
389429

390-
It selects all children.
430+
It selects all `p` elements in the document.
391431

392432
---
393433

394-
It styles odd children.
434+
It selects the first child of every `p` element.
395435

396436
#### --answer--
397437

398-
It selects the fourth child.
438+
It selects the first `p` element within a parent container.
399439

400440
### --question--
401441

@@ -405,19 +445,19 @@ What does the `:last-of-type` pseudo class do?
405445

406446
#### --distractors--
407447

408-
It selects the first child element.
448+
It selects the first child element of a specific type within its parent.
409449

410450
---
411451

412-
It selects the middle element.
452+
It selects the middle child element of a specific type within its parent.
413453

414454
---
415455

416-
It selects every element in a group.
456+
It selects every child element of a specific type within its parent.
417457

418458
#### --answer--
419459

420-
It selects the last sibling element.
460+
It selects the last child element of a specific type within its parent.
421461

422462
### --question--
423463

@@ -453,7 +493,7 @@ Which one of these is a functional pseudo-class?
453493

454494
---
455495

456-
`:last-of-type`
496+
`:match()`
457497

458498
---
459499

@@ -483,5 +523,4 @@ Which one of these is not a functional pseudo-class?
483523

484524
#### --answer--
485525

486-
`::before`
487-
526+
`:contains()`

curriculum/challenges/english/25-front-end-development/review-css-pseudo-classes/671a907bad4538752765f2ff.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Review the concepts below to prepare for the upcoming quiz.
3838
- **`: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.
3939
- **`: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.
4040
- **`: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.
4243

4344
## Tree-structural Pseudo-classes
4445

@@ -48,14 +49,13 @@ Review the concepts below to prepare for the upcoming quiz.
4849
- **`:nth-child(n)` Pseudo-class**: This pseudo-class allows you to select elements based on their position within a parent.
4950
- **`:nth-last-child(n)` Pseudo-class**: This pseudo-class enables you to select elements by counting from the end.
5051
- **`: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.
5354
- **`:first-of-type` Pseudo-class**: This pseudo-class selects the first occurrence of a specific element type within its parent.
5455
- **`:last-of-type` Pseudo-class**: This pseudo-class selects the last occurrence of a specific element type within its parent.
5556
- **`: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.
5657
- **`:only-of-type` Pseudo-class**: This pseudo-class selects an element if it's the only one of its type within its parent.
5758

58-
5959
## Functional Pseudo-classes
6060

6161
- **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) {
9191
}
9292
```
9393

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+
94102
## Pseudo-elements
95103

96104
- **`::before` Pseudo-element**: This pseudo-element uses the `content` property to insert cosmetic content like icons just before the element.

0 commit comments

Comments
 (0)