3/17/2022 Flashcards

1
Q

Why do two div elements “vertically stack” on one another by default?

A

Because div elements are block elements by default and block elements start on a new line.

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

What is the default flex-direction of an element with display: flex?

A

The default flex-direction of an element with display: flex is row.

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

What are the four components of “the Cascade”.

A
  1. Source order
  2. Inheritance
  3. Specificity
  4. !important
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the term “source order” mean with respect to CSS?

A

Source order refers to the order that rules are written in the CSS stylesheet. Source order determines that the last rule written for an element is the style that will be applied to that element.

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

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?

A

Inheritance allows styles defined for a parent to be applied to its children as long as no style is already declared for a child.

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

List the three selector types in order of increasing specificity.

A
  1. type selectors
  2. class selectors
  3. id selectors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is using !important considered bad practice?

A

It makes debugging difficult because it breaks the natural cascading in stylesheets due to !important overriding all other declarations.

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

What is the default value for the position property of HTML elements?

A

Static

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

How does setting position: relative on an element affect document flow?

A

It doesn’t affect document flow

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

How does setting position: relative on an element affect where it appears on the page?

A

It does not affect where it appears on the page. You can offset it with the top, right, bottom and left properties.

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

How does setting position: absolute on an element affect document flow?

A

position: absolute takes an element out of the normal flow and does not affect the position of the other elements on the page.

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

How does setting position: absolute on an element affect where it appears on the page?

A

It is positioned relative its closest positioned ancestor, if any. If it doesn’t have one, it is positioned relative to its initial containing block. It is offset using the top, right, bottom or left properties.

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

How do you constrain an absolutely positioned element to a containing block?

A

You set the position of the constraining block to position: relative.

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

What are the four box offset properties?

A

Top, right, bottom, and left.

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