CSS Flashcards

1
Q

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

A

selector: indicates which elements to apply styling to
declaration: includes properties and values; indicates how the element(s) should be styled

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

How do you select elements by their class attribute?

A

with a period;
Ex: .class

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

How do you select elements by their tag name?

A

Just use the name of the element’s tag.

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

How do you select an element by its id attribute

A

Use a #
Ex: #id

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

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

A

rgb: values for red, green, blue expressed as numbers between 0 and 255
hex: represent values for red, green blue in hexidecimal code
color name: predetermined, limited

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

Margin, padding, border

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 adds 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 elements
example: :hover

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

Gives the user feedback - helps them track where they’re at or what they’ve done on the site

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, percentages, and ems

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

Nowrap –> all flex items will be on one line

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

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

A

Because they’re block elements

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

What are the three helper classes you should have for page layouts?

A

container, row and column

17
Q

What are the four components of “the Cascade”?

A
  1. source order
  2. inheritance
  3. specificity
  4. !important
18
Q

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

A

The order in which your CSS rules are written
the last styling written will be what’s applied to the element

19
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

20
Q

List the three selector types in order of increasing sepcificty.

A

type, class, id

21
Q

Why is using !important considered bad practice?

A

You shouldn’t need to use it if you understand specificity and are effectively using it

22
Q

What does the transform property do?

A

It allows us to rotate, scale, skew or translate an element

23
Q

Give 4 examples of CSS transform functions.

A

translate, rotate, skew, scale

24
Q

The transition property is shorthand for which 4 properties of CSS?

A
  1. transition-property
  2. transition-duration
  3. transition-timing-function
  4. transition-delay
25
Q

What’s a breakpoint in responsive web design?

A

it’s a point where a website’s content will adapt a certain way to provide better user experience

26
Q

What’s the advantage of using a percentage width instead of a fixed width for a “column” class in a responsive layout?

A

using percentage accounts for the screen’s width (that might potentially change) vs pixels which will always be the same

27
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

Bc of the cascade –> rules written lower on the css document will take precedence