Specificity Flashcards

1
Q

What determines which CSS rule is applied when there are competing declarations?

A

CSS uses specificity to decide between competing declarations.

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

What are the three components of the specificity triad?

A

The three components are A (id-like specificity), B (class-like specificity), and C (element-like specificity).

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

In CSS specificity, what does a higher value in component A signify?

A

A higher value in component A (id-like specificity) means the rule is more specific.

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

How are two specificity values compared when their first component is equal?

A

If the first components are equal, compare the next higher specificity value.

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

Which specificity is more specific: (1, 0, 0) or (0, 4, 3)?

A

(1, 0, 0) is more specific than (0, 4, 3).

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

How does specificity work in complex and compound selectors?

A

Each part of a complex or compound selector adds to the specificity.

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

What is the specificity of the selector a.my-class.another-class[href]?

A

The specificity is (0, 3, 1).

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

What role does element-like specificity (C) play in determining CSS specificity?

A

Element-like specificity (C) is the third component and is used when the first two components are equal.

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

How would a selector with an ID (e.g., #id) compare to a selector with only classes and elements (e.g., .class a) in specificity?

A

A selector with an ID (#id) is more specific than a selector with only classes and elements.

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

What happens when two specificity values are tied in the first and second components?

A

When the first and second components are tied, the comparison moves to the third component (element-like specificity).

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