CSS Flashcards

1
Q

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

A

selector {declaration} declaration = (property:) (value)

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

using the .class selector

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 tag name?

A

just using the tag type

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

using the #id selector

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

What CSS properties make up the box model?

A

margin, padding, border, height, width

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
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
8
Q

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

A

rgba, rgb, hexcode, color

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

What is a pseudo-class?

A

Class that comes from a special state. under the browser’s control. You can prepare for them but not control them.

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

they make things easier as they allow interaction with the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
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
12
Q

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

A

no wrap.

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

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

A

div elements are block elements and take up the entire row

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

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

A

row

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

What are the three primary components of a page layout? (Which helper classes do you need?)

A

container, column, row

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

What is the minimum number of columns that you should put in a row?

A

1

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

What is the purpose of a container?

A

boundary of content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
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
18
Q

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

A

no effect on document flow. like a out of body feeling.

19
Q

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

A

move relative where it would normally exist if static.

20
Q

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

A

it affects it as if it doesn’t exist.

21
Q

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

A

absolutes are taken off of the page entirely so it finds an environment to exist in so it’s looking for any position layout.

22
Q

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

A

its positioned against its first non static ancestor, But if not found, it positioned against page.

23
Q

What are the four box offset properties?

A

top, bottom, left, right.

24
Q

Name two types of units that can be used to adjust font-size in CSS.

A

em, rem

25
Q

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

A

font-family

26
Q

What is the purpose of variables?

A
27
Q

How do you declare a variable?

A

with the key word var const or let set to a value

28
Q

How do you initialize (assign a value to) a variable?

A

=

29
Q

What characters are allowed in variable names?

A

Var name rules must start with _ $ or a letter but no numbers. can contain anything - or . within name. no keywords or reserved words.

no same name. Should describe what is stored and should be in camelcase.

30
Q

What does it mean to say that variable names are “case sensitive”?

A

same names with different cases are considered different variables

31
Q

What is the purpose of a string?

A

to store numbers, letters, and other characters

32
Q

What is the purpose of a number?

A

to store a number for arithmetics

33
Q

What are the four components of “the Cascade”.

A

source order, inheritance, specificity, !important

34
Q

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

A

the bottom css source with the same weight value will have its property inherited.
Styling closer to the bottom has higher priority.

35
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.

36
Q

List the three selector types in order of increasing specificity.

A

type, class, id

37
Q

Why is using !important considered bad practice?

A

It is applied no matter the specificity so same layers will be applied to greater specificity.

38
Q

The transition property is shorthand for which four CSS properties?

A

transition-property, transition-duration, transition-timing-function, and transition-delay.

39
Q

What does the transform property do?

A

It lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.

40
Q

Give four examples of CSS transform functions.

A

matrix translate rotate skew scale

41
Q

What is a breakpoint in responsive Web design?

A

It is the point were the content and design will adapt.

42
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

for the sake of it scaling instead of being stuck looking nice under one size

43
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

source order

44
Q

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

A

<meta></meta>

45
Q

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

A

print and screen