CSS Flashcards

1
Q

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

A
  • Selector
  • Declaration Block
  • Declaration (Property: 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

Using HTML element name.

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

What is a pseudo-class?

A

A keyword added to a selector that specified a special state of the selected element(s).

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

What are CSS pseudo-classes useful for?

A

Add styling based on an element’s state.

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

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

A

Static - Elements are im order. as they appear in the document flow.

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

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

A

The elements is positioned relative to its normal position.

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

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

A

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

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

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

A

The element will appear in its first positioned ancestor element that doesn’t have a value of static.

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

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

A

Using position: other than static on the containing block.

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

What are the four box-offset properties?

A
  • Top
  • Right
  • Bottom
  • Left
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

• They are block-level elements.

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

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

A

Row

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

Name at least two units of type size in CSS.

A
  • Pixels
  • Em
  • Percentage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What CSS property controls the font used for the text inside an element?

A

font-family

17
Q

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

A

row

18
Q

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

A

nowrap

19
Q

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

A
  • Color Names
  • Hex Codes
  • RGB Values
  • HSL Colors
20
Q

What are the four components of “the cascade”?

A
  • Source Order
  • Inheritance
  • Specificity
  • !important
21
Q

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

A

The order that your CSS rules are written in your stylesheet. The styling for an element last in your stylesheet will take effect.

22
Q

How is it possible for the style of an element to be applied to its children as well without an additional CSS rule?

A

Inheritance.

23
Q

List the three selector types in order of increasing specificity.

A
  • Type Selector
  • Class Selector
  • ID Selector
24
Q

Why is using !important considered bad practice?

A

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

25
Q

What CSS properties make up the box model?

A
  • Border
  • Margin
  • Padding
26
Q

Which CSS property pushes boxes away from each other?

A

Margin.

27
Q

Which CSS property adds space between a box’s content and its border?

A

Padding.