CSS Flashcards

1
Q

What are the names of the individual pieces of a CSS rule?

A

selector {property: value;
}
declaration block

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

How do you select elements by their class attribute?

A

.class { }

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

How do you select elements by their type?

A

element-name { }

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

How do you select an element by its id attribute?

A

id { }

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

Name three different types of values you can use to specify colors in CSS.

A

rgb
Hex code
color name

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

What CSS properties make up the box model?

A

Content, padding, border, margin

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

Which CSS property pushes boxes away from each other?

A

margin

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

Which CSS property adds spaces between a box’s content and its border?

A

padding

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

What is a pseudo-class?

A

keyword added to selector that specifies a special state of selected elements

notated by a colon

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

What are pseudo-classes useful for?

A

can style specific states of the selector such as when the user hovers, clicks, etc

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

Name at least 2 units of type size in CSS.

A

pixels, rem, ems, %, etc

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

What CSS property controls the font used for the text inside an element?

A

font-family

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

What is the default flex-direction of a flex container?

A

row

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

What is the default flex-wrap of a flex container?

A

nowrap

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

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

A

They are block elements

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

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

17
Q

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

18
Q

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

A

element can be offset from their normal position with no effect on other elements

19
Q

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

A

the element can be offset from its normal position using top, bottom, left, right

20
Q

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

A

The other elements act as if it doesn’t exist

21
Q

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

A

The element will sit on its own layer and is positioned relative to its nearest positioned ancestor (not static ancestor) otherwise, the initial containing block

22
Q

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

A

set the containing block’s position to non-static

23
Q

What are the four box offset properties?

A

top, bottom, left, right

24
Q

What are the four components of “the Cascade”?

A

Source order, inheritance, specificity, !important

25
What does the term "source order" mean with respect to CSS?
The order that your CSS rules are written in the stylesheet. The styling provided by the last rule takes precedence
26
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
through inheritance
27
List the 3 selector types in order of increasing specificity
element < class < ID
28
Why is using !important considered bad practice?
Makes debugging more difficult by breaking the natural cascade of stylesheet It is better to consider ways to use specificity
29
What does the transform property do?
Lets you rotate, scale, skew or translate an element
30
Give four examples of CSS transform functions
``` scale rotate translate skew matrix ```
31
The transition property is shorthand for which four CSS properties?
property, duration, timing function, delay
32
What is a breakpoint in responsive Web Design?
The points at which layout will break so need to introduce a media rule at that point to prevent it
33
What is the advantage of using a percentage width instead of a fixed width for a "column" class in a responsive layout?
The ratio of the items displayed on the screen will be preserved using percentage
34
If you introduce CSS rules for a smaller min-width after the styles for a larger min-width in your style sheet, the CSS rules for the smaller min-width will "win". Why is that?
Because of source order