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 a pseudo-class?

A

a class applied to a selector that specifies a special state of the selected element

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

What are CSS pseudo-classes useful for?

A

applying styling based on user actions not only in relation to the content of the document tree, but also in relation to external factors like the history of the navigator (:visited, for example), the status of its content (like :checked on certain form elements), or the position of the mouse

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

What are some examples of a pseudo-class?

A

:hover, :active, :focus, :link, :visited

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

Name at least two units of type size in CSS.

A

rem, px, pt

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

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

A

selector {property: value}

…declaration = property:value

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

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

A

.class-name {
property: value
}

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

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

A

p {
property: value
}

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

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

A
#id-element {
  property: value
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

rgb/a, color keywords (black, red, blue, etc), hex codes

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

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

A

divs are block elements

17
Q

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

A

row

18
Q

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

A

position: static

19
Q

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

A

the element remains a part of the normal document flow

20
Q

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

A
  • relative positioning moves an element in relation to where it would have been in normal flow
  • if there are no other elements, there would be no change to its movement
21
Q

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

A

the element is taken out of the document flow and no longer affects the position of other elements on the page

22
Q

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

A

“top, bottom, left, and right” now tells us the distance the element should be from the containing element. rather than its relative position in the normal document flow

23
Q

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

A

“position: relative” on the element and container

24
Q

What are the four box offset properties?

A

top, bottom, left, right

25
Q

What are the four components of “the Cascade”?

A
  1. source order
  2. inheritance
  3. specificity
  4. important rule
26
Q

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

A

the rule that comes last is the one that will be applied

27
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: child elements inherit the property values of its parent element
- extra note: not all properties are inheritable!

28
Q

List the three selector types in order of increasing specificity

A
    1. tag (type) selectors
    1. class selectors
    1. id selectors
29
Q

Why is using !important considered bad practice?

A

breaks the natural cascading in your stylesheets and makes debugging more difficult

30
Q

What does the “all” property indicate as a CSS rule?

A

allows you to control inheritance for all properties at once

e.g. p { all: revert; } would revert the style of p elements to the default

31
Q

What does the transform property do?

A

allows you to modify the appearance of HTML elements

32
Q

Give four examples of CSS transform functions.

A
  • transform: translate();
  • transform: scale();
  • transform: rotate();
  • transform: skew();
33
Q

The transition property is shorthand for which four CSS properties?

A

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

34
Q

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

A

width, min-width, height, color, etc

35
Q

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

A

viewport meta tag

36
Q

What is a breakpoint in responsive Web design?

A

the point of dimension at which the layout or design of the website will change

37
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
  • a percentage will change based on how wide the screen currently is
  • a fixed width is static and will not change
38
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 (order matters in CSS rules )