CSS Flashcards

1
Q

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

A

Selector, declaration, property, and 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

.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

typename { }

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

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 values, Hex codes, Color Names

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

PBM - 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 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 pseud-class?

A

keyword added to a selector that specifies a special state of the selected element(s)

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

special situations (nth-child)

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

em (relative to the font-size of direct or nearest parent) , rem (only relative to the html root font-size)

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 (left to right)

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 (all flex items will be on one line)

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

div is block element and will appear on new line

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 (left to right)

17
Q

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

A

static (normal flow)

18
Q

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

A

this does not affect the position of surrounding elements; they stay in the position they would be in normal flow (does not affect document flow)

19
Q

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

A

nothing changes

20
Q

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

A

absolute positioning removes document flow and ignores surrounding elements

21
Q

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

A

absolute is for layering elements on top of other elements

22
Q

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

A

position: relative or non-static parent

23
Q

what are the four box offset properties?

A

top, left, right, bottom

24
Q

what are the four components of “the cascade”

A

source order, inheritance, specificity, !important

25
Q

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

A

the order that your CSS rules are written in your stylesheet

26
Q

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

A

inheritance

27
Q

list the three selector types in order of increasing specifcity

A

type, class, ID

28
Q

why is using !important considered bad practice

A

makes debugging more difficult by breaking the natural cascading in your stylesheets

29
Q

what does the transform property do?

A

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

30
Q

give four examples of CSS functions

A

translate()
scale()
rotate()
skew()

31
Q

the transition property is shorthand for which four CSS properties?

A

delay
duration
property
timing-function

32
Q

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

A

width

orientation

33
Q

which HTML meta tag is used in mobile-responsive web pages

A

viewport

34
Q

what is a breakpoint in responsive web design

A

the points at which a media query is introduced

35
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

% changes element size relative to parent and your page will dynamically change to fit

36
Q

if you introduce CSS rules for a smaller min-width after the styles for a large min-width, the CSS rules for the smaller min width will “win.” why is that?

A

the rule that occurs last takes precedence in the cascade

source order