CSS Flashcards

1
Q

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

A

selector, declaration block {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

.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

write the 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

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

A

RGB
Hexadecimal
Color Name

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

border, margin, padding, width, height

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 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
9
Q

What is a pseudo-class?

A

keyword added to a selector that specifies a special state of the selected element(s)/changes the appearance of elements when a user is interacting with them

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

applying styling based on user interaction

applying styling based on the structure of the html document (nth child)

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

Name two types of units that can be used to adjust font-size in CSS

A

px
rem
em
percentage

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

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

Flex items with all try to fit onto one line (nowrap)

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

Because they are block elements and each element takes up the full available width.

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

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

What two pieces of styling are added to the container class?

A

margin: auto

max-width

18
Q

What type of styling is applied to a row class?

A

display: flex

19
Q

What’s the purpose of the container class?

A

To set the boundaries that’s going to hold the content

20
Q

What’s the purpose of the row class?

A

to set up vertical content

21
Q

What’s the purpose of the column class?

A

To set up the boundaries of horizontal content

22
Q

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

A

static

everything flows normally

23
Q

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

A

It moves an element in relation to where it would have been in normal flow, shifting it to the top, right bottom or left of where it would have been place (dependent on the settings that you choose)

24
Q

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

A

It doesn’t affect the position of surrounding elements; they stay in the position they would be in normal flow

25
Q

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

A

It does not affect the position of any surrounding elements (they simply ignore the space it would’ve taken up). Absolutely positioned elements move as users scroll up and down the page.
No longer a part of normal document flow–everything ignores it as if it doesn’t exist

26
Q

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

A

It positions the element in relation to its containing element.
Sits at the top of its nearest ancestor that is not static

27
Q

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

A

Set a position property on the container element (the ancestor element) that’s not static

28
Q

What are the four box offset properties?

A

top
left
right
bottom

29
Q

Which positioning property causes the least amount of affect/chaos?

A

relative

30
Q

What are the four components of “the Cascade”.

A
  1. Source order
  2. Inheritance
  3. Specificity
  4. !important
31
Q

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

A

Source order is, simply put, the order that your CSS rules are written in your stylesheet. The styling provided for an element last in your stylesheet is the styling that will ultimately take effect.

32
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

33
Q

List the three selector types in order of increasing specificity.

A

type –> class –> id

34
Q

Why is using !important considered bad practice?

A

You’re bypassing all the preset rules

35
Q

What does the transform property do?

A

lets you rotate, scale, skew, or translate an element by modifying the coordinate space of the CSS visual formatting model. (where it is in coordinate space)

36
Q

Give four examples of CSS transform functions.

A

translate
scale
rotate
skew

37
Q

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

A

width

height

38
Q

Reading:
Media ruleset only media type “screen” and media feature “min-width” with value 768 px

@media only screen and (min-width: 768 px) {

A
39
Q

What is a breakpoint in responsive Web design?

A

The point at which you want to use a media query to change the design to a better one for the space you have available

40
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

It’s relative to whatever device/screen you’re on (adaptability)

41
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

Because of source order-the bottom one wins out