CSS Flashcards

1
Q

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

A
  • Selector (element, class or id)
  • Declaration Block
  • Property & Value (declaration)
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

.classname{ }

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

elementname { }

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

idname { }

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
  • Border
  • Padding
  • Margin
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

What is a pseudo-class?

A

A class applied to an element by the browser in a certain situation

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

What are CSS pseudo-classes useful for?

A

To make the website stylistically dynamic based on user interaction

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

Name at least two units of type size in CSS.

A
  • px
  • %
  • em - default font size from container
  • rem - default font size from doc root
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
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
12
Q

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

A

flex-direction: row;

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

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

A

flex-wrap: nowrap;

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

Which axis does the justify-content property apply to?

A

main-axis (default is x-axis)

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

Which axis does align-content property apply to?

A

cross-axis (default is y-axis)

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

What is the difference between align-content and align-item?

A
  • align-content applies changes to multiple rows
  • align-item applies changes to the items within a
    single row
17
Q

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

A

Block level elements like div will take 100% width, so they naturally stack

18
Q

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

A

flex-direction: row

19
Q

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

A

position: static

20
Q

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

A
  • Relative elements remain in the document flow
  • If moved it will still occupy (space wise) the
    original spot it was in
21
Q

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

A

The new position is relative to where it’s block would have been

22
Q

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

A

It takes the element out of the normal document flow

23
Q

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

A

It moves the element based on the first non-static parent element

24
Q

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

A
  • position: relative on the containing block

- position: absolute on the desired elements

25
Q

What are the four box offset properties?

A
  • top
  • bottom
  • left
  • right
26
Q

What are the four components of “the Cascade”.

A
  • Source order
  • Inheritance
  • Specificity
  • !important
27
Q

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

A

Last ruleset will be applied if there are multiple rulesets targeting the same property and value

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

If the style being applied to the parent element is an inheriting property

29
Q

List the three selector types in order of increasing specificity.

A
  • Type selector
  • Class selector
  • ID selector
30
Q

Why is using !important considered bad practice?

A

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

31
Q

What does the transform property do?

A

Transform moves the element on it’s x and y axis

32
Q

Give four examples of CSS transform functions.

A
  • matrix()
  • rotate()
  • scale()
  • skew()
  • translate()
33
Q

The transition property is shorthand for which four CSS properties?

A
  • transition-property
  • transition-duration
  • transition-timing-function
  • transition-delay

transition: margin-right 2s ease-in 0.5s