CSS: Pseudo-Classes Flashcards

(44 cards)

1
Q

What are Pseudo-Classes?

A

These are special CSS keywords that allow you to select an element based on its specific state or position.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are User Action Pseudo-Classes?

A

These are special keywords that allow you to change the appearance of elements based on user interactions, improving the overall user experience.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the “:active” Pseudo-Class?

A

This pseudo-class lets you select the active state of an element, like clicking on a button.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the “:hover” Pseudo-Class?

A

This pseudo-class defines the hover state of an element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the “:focus” Pseudo-Class?

A

This pseudo-class applies styles when an element gains focus, typically through keyboard navigation or when a user clicks into a form input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the “:focus-within” Pseudo-Class?

A

This pseudo-class is used to apply styles to an element when it or any of its descendants have focus.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are “input” Pseudo-Classes?

A

These pseudo-classes are used to target HTML input elements based on the state they are in before and after user interaction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the “:enabled” Pseudo-Class?

A

This pseudo-class is used to target form buttons or other elements that are currently enabled.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the “:disabled” Pseudo-Class?

A

This pseudo-class lets you style an interactive element in disabled mode.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the “:checked” Pseudo-Class?

A

This pseudo-class is used to indicate to the user that it is checked.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the “:valid” Pseudo-Class?

A

This pseudo-class targets the input fields that meet the validation criteria.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the “:invalid” Pseudo-Class?

A

This pseudo-class targets the input fields that do not meet the validation criteria.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the “:in-range” and “:out-of-range” Pseudo-Classes?

A

These pseudo-classes apply styles to elements based on whether their values are within or outside specified range constraints.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the “:required” Pseudo-Class?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the “:optional” Pseudo-Class?

A

This pseudo-class applies styles input elements that are not required and can be left empty.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the “:autofill” Pseudo-Class?

A

This pseudo-class applies styles to input fields that the browser automatically fills with saved data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are Location Pseudo-Classes?

A

These pseudo-classes are used for styling links and elements that are targeted within the current document.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the “:any-link” Pseudo-Class?

A

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.

19
Q

What is the “:link” Pseudo-Class?

A

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.

20
Q

What is the “:local-link” Pseudo-Class?

A

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.

21
Q

What is the “:visited” Pseudo-Class?

A

This pseudo-class targets a link the user has visited.

22
Q

What is the “:target” Pseudo-Class?

A

This pseudo-class is used to apply styles to an element that is the target of a URL fragment.

23
Q

What is the “:target-within” Pseudo-Class?

A

This pseudo-class applies styles to an element when it or one of its descendants is the target of a URL fragment.

24
Q

What are Tree-Structural Pseudo-Classes?

A

These pseudo-classes allow you to target and style elements based on their position within the document tree.

25
What is the ":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.
26
What is the ":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.
27
What is the ":nth-child()" Pseudo-Class?
This pseudo-class allows you to select elements based on their position within a parent.
28
What is the ":nth-last-child()" Pseudo-Class?
This pseudo-class enables you to select elements by counting from the end.
29
What is the ":first-child" Pseudo-Class?
This pseudo-class selects the first element in a parent element or the document.
30
What is the ":last-child" Pseudo-Class?
This pseudo-class selects the last element in a parent element or the document.
31
What is the ":only-child" Pseudo-Class?
This pseudo-class selects the only element in a parent element or the document.
32
What is the ":first-of-type" Pseudo-Class?
This pseudo-class selects the first occurrence of a specific element type within its parent.
33
What is the ":last-of-type" Pseudo-Class?
This pseudo-class selects the last occurrence of a specific element type within its parent.
34
What is the ":nth-of-type()" 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.
35
What is the ":only-of-type" Pseudo-Class?
This pseudo-class selects an element if it's the only one of its type within its parent.
36
What are 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.
37
What is the ":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.
38
What is the ":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.
39
What is the ":has()" Pseudo-Class?
This pseudo-class is often dubbed the "parent" selector because it allows you to style elements that contain child elements specified in the selector list.
40
What is the ":not()" Pseudo-Class?
This pseudo-class is used to select elements that do not match the provided selector.
41
What is the "::before" Pseudo-Element?
This pseudo-element uses the content property to insert cosmetic content like icons just before the element.
42
What is the "::after" Pseudo-Element?
This pseudo-element uses the content property to insert cosmetic content like icons just after the element.
43
What is the "::first-letter" Pseudo-Element?
This pseudo-element targets the first letter of an element's content, allowing you to style it.
44
What is the "::marker" Pseudo-Element?
This pseudo-element lets you select the marker (bullet or numbering) of list items for styling.