css Flashcards

1
Q

what CSS properties make up the box model?

A

border, margin, padding

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

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

A

selectors

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

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

A

dot followed by the class name

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

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

A

type selector

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

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

A

pound sign followed by the id name

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

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

A

hex, rgb, color keywords

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

what is a pseudo-class?

A

noted by a colons to allow extra functionality to certain css selectors

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

what are CSS pseudo-classes useful for?

A

hover, visited, etc elements, i.e., a different color for a hovered anchor tag, a set color for a visited anchored tag to indicated its been clicked

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

name at least two units of type size in CSS

A

px, rem, em

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

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

A

nowrap

17
Q

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

A

sets as a division of content; vertically (one below the other continuously) is default

18
Q

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

A

row

19
Q

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

A

static (each block-level element sits on top of the next one)

20
Q

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

A

moves an element in relation to where it would have been in normal flow (i.e., top, left, bottom, right, in pixels, percentages, or ems)

21
Q

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

A

box is taken out of normal flow and no longer affects the position of other elements on the page; relative does no changes to element if you dont define the offset properties

22
Q

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

A

acts like it is not there

23
Q

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

A

not static; persistent; doesn’t affect it’s surrounding but overrides them; acts as 1 z-index above the other content (?)

24
Q

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

A

position relative; edit padding based on nearest ancestor block

25
Q

What are the four box offset properties?

A

top, bottom, left, or right

26
Q

What are the four components of “the Cascade”

A
  1. Importance 2. Origin 3. Specificity 4. Position.
27
Q

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

A

that the order of CSS rules matter; when two rules apply that have equal specificity the one that comes last in the CSS is the one that will be used

28
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; rule applies to all ancestor elements within the document; you can establish the basis for a consistent visual design with very little code; these styles will even apply to HTML you have yet to write; to make sure all elements inherit these properties from the global scope, I can use the universal selector and the inherit keyword

29
Q

List the three selector types in order of increasing specificity.

A
  1. type selectors (i.e., h1), pseudo-elements (i.e., ::after) 2. classes (i.e., .bio), attribute selectors (i.e., [type=”text”]), pseudo-classes (i.e., :hover) 3. id selectors (#imgCorrection)
    although: inline styles override and have the highest specificity
30
Q

Why is using !important considered bad practice?

A

makes debugging more difficult by breaking the natural cascading in your stylesheets; when two conflicting declarations with the !important rule are applied to the same element, the declaration with a greater specificity will be applied;

disrupting the natural flow

avoids debugging; makes your stylesheet harder to maintain

it overrides specificity by giving a CSS value more weight than it naturally has

31
Q

what type of scope does css have?

A

a global scope and a local scope like javascript: the local scope has access to the parent and global scope

32
Q

What does the transform property do?

A

adjusting the element coordinate plane

33
Q

Give four examples of CSS transform functions.

A

rotate, translate, scale, skew, matrix, translateX, translateY

34
Q

The transition property is shorthand for which four CSS properties?

A

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

35
Q

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

A

height, width

36
Q

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

A

viewport tag

37
Q

What is a breakpoint in responsive Web design?

A

points at which a media query is introduced

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

layout flexibility/adaptability

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

specificity/precedence