CSS Flashcards

1
Q

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

A

Selector, opening curly braces for declaration block, declaration: property with its value, closing curly braces for declaration block.

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

with a dot . Ex. .class

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

with the name of the type/element

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

with # Ex. #idname

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, hsl

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

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 keyword added to a selector that specifies a special state of the selected element(s). it’s a class applied by browser

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

It allows to change the appearance of element when user interacts with them :hover :focus :active

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

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

A

font-size: em; px; %

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 div is block-level element

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

row is the default. there are row-reverse, column, column-reverse as well.

17
Q

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

A

static

18
Q

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

A

it doesn’t affect, sit on same spot, normal document flow, only will affect within its position if the properties were declared

19
Q

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

A

as it would in normal flow

20
Q

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

A

it is removed from it’s surrounding element, not a normal flow

21
Q

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

A

to the relative position of the parent that is containing. near the closest parent. top of it’s nearing ancestor that is not position: static; ( will be relative, fixed)

22
Q

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

A

make sure the value is not static for the ancestor.

23
Q

What are the four box offset properties?

A

static, relative, absolute, fixed

24
Q

Four box off set properties

A

top, left, bottom, right

25
Q

when should you only use absolute position?

A

for layered of elements, when it needs to overlap another element

26
Q

when should you use position relative

A

only minor adjustments

27
Q

What are the four components of “the Cascade”.

A

Source Order, Inheritance, Specificity, & !important

28
Q

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

A

where is the rule set placed, more recent (last rule) overules the previous rule. rule set that is lower is higher than others

29
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

30
Q

List the three selector types in order of increasing specificity.

A

type, class, id

31
Q

Why is using !important considered bad practice?

A

reverse cascade and override all rules even from external libraries like Bootstrap, normalize.css, third party scripts.

32
Q

What does the transform property do?

A

lets you use other functions to rotate, scale, skew, or translate an element, by modifiying the coordinate space

33
Q

Give four examples of CSS transform functions.

A

matrix, translate, rotate, translateY, scale

34
Q

The transition property is shorthand for which four CSS properties?

A

transition-property, transition-duration, transition-timeing-function, transition-delay,

35
Q

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

A

min-width, max-width

36
Q

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

A

viewport

37
Q

What is a breakpoint in responsive Web design?

A

point at which a media query is introduced.

media query needs to be introduced where the content starts to break in some way.

38
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

it will only take the 50% of width no matter the size, but px will be in fixed size. therefore, will have to create more media query for all the fixed sizing values.

39
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

CSS Source order picks whatever is last(latest) in document