CSS Flashcards

1
Q

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

A

CSS selector, declaration block, properties, values

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

In CSS, how do you select elements by their class attribute?

A

’.’

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

In CSS, how do you select elements by their type?

A

Use its name

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

In CSS, how do you select an element by its id attribute?

A

Use a ‘#’

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

keyword, rgb function, hex representation

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

margin, border, padding, width, height

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 add space 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

A special state of an element

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

What are CSS pseudo-classes useful for?

A

Highlighting an element when the user interacts with it

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

Name at least two units of type size in CSS.

A

px, rem

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

Because 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?

A

left to right

17
Q

What are the four components of “the Cascade”?

A

source order, specificity, inheritance, important

18
Q

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

A

Last rule of the same specificity gets applied.

19
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

20
Q

List the three selector types in order of increasing specificity.

A

type, class, id

21
Q

Why is using !important considered bad practice?

A

Goes against the grain of cascade. Makes rules hard to reuse.

22
Q

What does the transform property do?

A

Rotates, scales, skews, or translates an element

23
Q

Give four examples of CSS transform functions.

A

matrix, rotate, scale, skew

24
Q

Give two examples of media features that you can query in an @media rule.

A

width, min-width, max-width

25
Q

Which HTML meta tag is used in mobile-responsive web pages?

A

name =”viewport” content=”width-device-width, initial-scale=1.0”

26
Q

What is a breakpoint in responsive Web design?

A

The point where it breaks to a new form of styling to accommodate varying screen size.

27
Q

What is the advantage of using a percentage (e.g. 50%) width instead of a fixed (e.g. px) width for a “column” class in a responsive layout?

A

Percentage will adjust as the screen width changes

28
Q

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?

A

The one that’s lower will take effect because of source order.