The cascade Flashcards

1
Q

What is the CSS cascade?

A

The algorithm that resolves conflicts when multiple CSS rules apply.

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

What are the four stages of the CSS cascade?

A
  1. Position and order of appearance
  2. Specificity
  3. Origin
  4. Importance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does position and order of appearance affect CSS rules?

A

The rule that appears later in the stylesheet wins conflicts.

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

What does the specificity stage determine?

A

It determines which CSS selector has the strongest match using a scoring system.

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

How does specificity affect CSS rules?

A

More specific selectors override less specific ones.

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

What is the origin in the CSS cascade?

A

It refers to where a CSS rule comes from (e.g., browser styles, user styles, or authored CSS).

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

How does origin influence which CSS rules are applied?

A

Rules from different origins follow a priority order, with authored CSS usually overriding browser defaults.

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

What is the importance stage in the CSS cascade?

A

It determines which rules are marked as important (!important overrides other rules).

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

What happens when two CSS rules have the same specificity?

A

The one that appears later in the stylesheet wins.

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

How can you check why a CSS rule is not being applied?

A

Use DevTools to inspect styles and find conflicts.

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

What tool can help visualize the origin and specificity of CSS rules?

A

Browser DevTools.

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

What does a CSS specificity algorithm do?

A

It calculates the strength of a selector to determine which rule is applied.

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

Why might a CSS rule not take effect even if it is written in the stylesheet?

A

It could be overridden by a more specific rule, an !important rule, or a later rule.

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

How do browser stylesheets affect the cascade?

A

Browsers apply default styles that can be overridden by authored styles with higher specificity.

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

What is the key takeaway of the CSS cascade?

A

The most relevant rule is determined by order, specificity, origin, and importance.

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