CSS Flashcards

1
Q

What are the four components of “the Cascade”.

A

inheritance, specificity, !important, source order

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

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

A

In CSS the last style rule set for a selector takes effect

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

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

List the three selector types in order of increasing specificity.

A

class column, type column, no value ( ),

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

Why is using !important considered bad practice?

A

it overrides everything

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

The transition property is shorthand for which four CSS properties?

A

transition - property, duration, timing-function, delay

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

What does the transform property do?

A

lets you rotate, scale, skew, or translate an element.

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

Give four examples of CSS transform functions.

A

Rotate, translate, scale, and skew

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, 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

.then name of class attribute

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 tag name?

A

just the name of the element

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 it’s id attribute?

A
  • # then name of id attribute
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, hex, hsl

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

What CSS properties make up the box model?

A

border, margin, padding, height and width

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

What 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
16
Q

Which CSS property add space between a box’s content and it’s border?

A

padding

17
Q

What is a pseudo-class?

A

a keyword added to a selector that specifies a special state of the selected element(s)

18
Q

What are CSS pseudo-classes useful for?

A

Easier to target css selectors that involve user interaction

19
Q

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

A

px and rem

20
Q

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

A

font-family

21
Q

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

A

row

22
Q

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

A

nowrap

23
Q

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

A

they are block elements

24
Q

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

A

row

25
Q

What are the 3 primary components of a page layout? (Which helper classes do you need)?

A

containers, columns, and rows

26
Q

What is the minimum number of columns that you should put in a row?

A

at least one

27
Q

What is the purpose of a container?

A

to group your rows and columns easier (basically similar to an outline)

28
Q

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

A

static

29
Q

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

A

It moves the element in relation to where it would have been in normal flow

30
Q

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

A

using offset properties you can indicate how far to move the element from where it would have been in normal flow

31
Q

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

A

it is taken out of normal flow and no longer affects the position of other elements on the page (it’s like the element no longer exists)

32
Q

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

A

the element can be positioned anywhere on the page relative to within the boundary of the next ancestor non static block

33
Q

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

A

by using the ancestor container that is not static

34
Q

Where are the four box offset properties?

A

top, bottom, left, and right

35
Q

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

A

Width, hover

36
Q

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

A

<meta></meta>

with the name=”viewport”

37
Q

What is a breakpoint in responsive Web design?

A

different rule set for different parameters

38
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 would scale with whatever the view page size is rather than having a set value and not adjust to the view page

39
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 the CSS cascade where the most recent rule set has priority