The cascade Flashcards

1
Q

What is the cascade ?

A

The cascade is the algorithm for solving conflicts where multiple CSS rules apply to an HTML element.

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

What are the 4 stages of the cascade algorithm ?

A

Position and order of appearance: the order of which your CSS rules appear

Specificity: an algorithm which determines which CSS selector has the strongest match

Origin: the order of when CSS appears and where it comes from, whether that is a browser style, CSS from a browser extension, or your authored CSS

Importance: some CSS rules are weighted more heavily than others, especially with the !important rule type

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

What is the order of specificity of CSS origins from less specific to more specific ?

A
  1. User agent base styles. These are the styles that your browser applies to HTML elements by default.
  2. Local user styles. These can come from the operating system level, such as a base font size, or a preference of reduced motion. They can also come from browser extensions, such as a browser extension that allows a user to write their own custom CSS for a webpage.
  3. Authored CSS. The CSS that you author.
  4. Authored !important. Any !important that you add to your authored declarations.
  5. Local user styles !important. Any !important that come from the operating system level, or browser extension level CSS.
  6. User agent !important. Any !important that are defined in the default CSS, provided by the browser.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the CSS specificity ?

A

It is an algorithm which determines which CSS selector has the strongest match

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

Which rule can have priority over an inlinestyleattribute ?

A

a declaration that has!importantdefined.

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

Which of a class and an element has the highest specificity ?

A

The class

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

What is the order of “importance” of css rules from least important, to most important ?

A

normal rule type, such asfont-size,backgroundorcolor

animationrule type

!importantrule type (following the same order as origin)

transitionrule type

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

What is the universal selector number of points ?

A

0 point

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

What is the number of point of an element or a pseudo-element selector ?

A

1 point

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

What is the number of point of class, pseudo-class and atrribute selectors ?

A

10 points

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

How many point does Tlthe:not()pseudo-class itself adds to the specificity calculation ?

A

Nothing. 0 points.

However, the selectors passed in as arguments do get added to the specificity calculation.

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

What is the number of points of an ID selector?

A

100 points

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

What is the number of points of an inline style attribute ?

A

CSS applied directly to thestyleattribute of the HTML element, gets aspecificity score of 1,000 points.

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

What is the number of points of an !importantrule attribute ?

A

10,000 points. This is the highest specificity that one individual item can get.

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