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: client/i18n/locales/english/intro.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1973,7 +1973,8 @@
1973
1973
"review-css-pseudo-classes": {
1974
1974
"title": "CSS Pseudo-classes Review",
1975
1975
"intro": [
1976
-
"Review the CSS Pseudo-classes concepts to prepare for the upcoming quiz."
1976
+
"Before you are quizzed on CSS pseudo-classes and pseudo-elements, you first need to review.",
1977
+
"Open up this page to review concepts like the <code>::before</code> and <code>::after</code> pseudo-elements as well as the <code>:hover</code>, <code>:active</code> pseudo-classes and more."
Copy file name to clipboardExpand all lines: curriculum/challenges/english/25-front-end-development/review-css-pseudo-classes/671a907bad4538752765f2ff.md
Review the concepts below to prepare for the upcoming quiz.
11
11
12
+
## User Action Pseudo-classes
12
13
14
+
-**Pseudo-classes Definition**: These are special CSS keywords that allow you to select an element based on its specific state or position.
15
+
-**User Action Pseudo-classes**: These are special keywords that allow you to change the appearance of elements based on user interactions, improving the overall user experience.
16
+
-**`:active` Pseudo-class**: This pseudo-class lets you select the active state of an element, like clicking on a button.
17
+
-**`:hover` Pseudo-class**: This pseudo-class defines the hover state of an element.
18
+
-**`:focus` Pseudo-class**: This pseudo-class applies styles when an element gains focus, typically through keyboard navigation or when a user clicks into a form input.
19
+
-**`:focus-within` Pseudo-class**: This pseudo-class is used to apply styles to an element when it or any of its descendants have focus.
20
+
21
+
## Input Pseudo-classes
22
+
23
+
-**Input Pseudo-classes**: These pseudo-classes are used to target HTML `input` elements based on the state they are in before and after user interaction.
24
+
-**`:enabled` Pseudo-class**: This pseudo-class is used to target form buttons or other elements that are currently enabled.
25
+
-**`:disabled` Pseudo-class**: This pseudo-class lets you style an interactive element in disabled mode.
26
+
-**`:checked` Pseudo-class**: This pseudo-class is used to indicate to the user that it is checked.
27
+
-**`:valid` Pseudo-class**: This pseudo-class targets the input fields that meet the validation criteria.
28
+
-**`:invalid` Pseudo-class**: This pseudo-class targets the input fields that do not meet the validation criteria.
29
+
-**`:in-range` and `:out-of-range` Pseudo-classes**: These pseudo-classes applies styles to elements based on whether their values are within or outside specified range constraints.
30
+
-**`:required` Pseudo-class**: This pseudo-class targets `input` elements that have the `required` attribute. It signals to the user that they must fill out the field to submit the form.
31
+
-**`:optional` Pseudo-class**: This pseudo-class applies styles input elements that are not required and can be left empty.
32
+
-**`:autofill` Pseudo-class**: This pseudo-class applies styles to input fields that the browser automatically fills with saved data.
33
+
34
+
## Location Pseudo-classes
35
+
36
+
-**Location Pseudo-classes**: These pseudo-classes are used for styling links and elements that are targeted within the current document.
37
+
-**`:any-link` Pseudo-class**: This pseudo-class is a combination of the :link and :visited pseudo-classes. So, it matches any anchor element with an href attribute, regardless of whether it’s visited or not.
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
+
-**`: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
+
-**`: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
42
+
43
+
## Tree-structural Pseudo-classes
44
+
45
+
-**Tree-structural Pseudo-classes**: These pseudo-classes allow you to target and style elements based on their position within the document tree.
46
+
-**`:root` Pseudo-class**: This pseudo-class is usually the root `<html>` element. It helps you target the highest level in the document so you can apply a common style to the entire document.
47
+
-**`:empty` Pseudo-class**: Empty elements, that is, elements with no children other than white space, are also included in the document tree. That's why there's an `:empty` pseudo-class to target empty elements.
48
+
-**`:nth-child(n)` Pseudo-class**: This pseudo-class allows you to select elements based on their position within a parent.
49
+
-**`:nth-last-child(n)` Pseudo-class**: This pseudo-class enables you to select elements by counting from the end.
50
+
-**`: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
53
+
-**`:first-of-type` Pseudo-class**: This pseudo-class selects the first occurrence of a specific element type within its parent.
54
+
-**`:last-of-type` Pseudo-class**: This pseudo-class selects the last occurrence of a specific element type within its parent.
55
+
-**`: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
+
-**`: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
+
59
+
## Functional Pseudo-classes
60
+
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.
62
+
-**`:is()` Pseudo-class**: This pseudo-class takes a list of selectors (ex. `ol`, `ul`) and selects an element that matches one of the selectors in the list.
63
+
64
+
```html
65
+
<pclass="example">This text will change color.</p>
66
+
<p>This text will not change color.</p>
67
+
<p>This text will not change color.</p>
68
+
<pclass="this-works-too">This text will change color.</p>
69
+
```
70
+
71
+
```css
72
+
p:is(.example, .this-works-too) {
73
+
color: red;
74
+
}
75
+
```
76
+
77
+
-**`:where()` Pseudo-class**: This pseudo-class takes a list of selectors (ex. `ol`, `ul`) and selects an element that matches one of the selectors in the list. The difference between `:is` and `:where` is that the latter will have a specificity of 0.
78
+
79
+
```css
80
+
:where(h1, h2, h3) {
81
+
margin: 0;
82
+
padding: 0;
83
+
}
84
+
```
85
+
86
+
-**`:has()` Pseudo-class**: This pseudo-class is often dubbed the `"parent"` selector because it allows you to style elements who contain child elements specified in the selector list.
87
+
88
+
```css
89
+
article:has(h2) {
90
+
border: 2pxsolidhotpink;
91
+
}
92
+
```
93
+
94
+
## Pseudo-elements
95
+
96
+
-**`::before` Pseudo-element**: This pseudo-element uses the `content` property to insert cosmetic content like icons just before the element.
97
+
-**`::after` Pseudo-element**: This pseudo-element uses the `content` property to insert cosmetic content like icons just after the element.
98
+
-**`::first-letter` Pseudo-element**: This pseudo-element targets the first letter of an element's content, allowing you to style it.
99
+
-**`::marker` Pseudo-element**: This pseudo-element lets you select the marker (bullet or numbering) of list items for styling.
0 commit comments