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

.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

Use 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 Values: rgb(102,205,170)
Hex Codes: #66cdaa
Color Names: MediumAquaMarine

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

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

A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s)

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

Pseudo-classes let you apply a style to an element not only in relation to the content of the document tree, but also in relation to external factors like the history of the navigator (:visited, for example), the status of its content (like :checked on certain form elements), or the position of the mouse (like :hover, which lets you know if the mouse is over an element or not).

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

Name at least two units of type size in CSS.

A

Pixels, percentages, 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 (inline, x-axis)

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

No wrap (inline)

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

What are the four components of “the Cascade”.

A

Source Order, Inheritance, !Important, Specificity

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

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

A

Source order is the order that your CSS rules are written in your stylesheet. The one on the bottom has priority as long as all the types above it are the same

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

List the three selector types in order of increasing specificity.

A

Type selector, class selector, id selector

19
Q

Why is using !important considered bad practice?

A

It’s going to override everything else. It’s too powerful.

20
Q

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

A

Because they are block elements

21
Q

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

A

Row

22
Q

What are the four components of “the Cascade”.

A

Source Order, Inheritance, !Important, Specificity

23
Q

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

A

Source order is the order that your CSS rules are written in your stylesheet. The one on the bottom has priority as long as all the types above it are the same

24
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

25
Q

List the three selector types in order of increasing specificity.

A

Type selector, class selector, id selector

26
Q

Why is using !important considered bad practice?

A

It’s going to override everything else. It’s too powerful.

27
Q

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

A

Because they are block elements

28
Q

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

A

Row

29
Q

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

A

static/normal

30
Q

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

A

This does not affect the position of surrounding elements; they stay in the position they would be in normal flow.

31
Q

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

A

It does not affect where it appears but it allows you to move it.

32
Q

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

A

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

33
Q

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

A

This positions the element in relation to its containing element. Absolutely positioned elements move as users scroll up and down the page.

34
Q

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

A

Set containing block to non static (sticky absolute, relative, fixed)

35
Q

What are the four box offset properties?

A

Top, bottom, left, right

36
Q

What does the transform property do?

A

The transform CSS property lets you rotate, scale, skew, or translate an element

37
Q

Give four examples of CSS transform functions.

A

Rotate, skew, scale, translate

38
Q

The transition property is shorthand for which four CSS properties?

A

transition-property, transition-duration, transition-timing-function, and transition-delay

39
Q

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

A

width

display-mode

40
Q

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

A

Viewport meta tag

41
Q

What is a breakpoint in responsive Web design?

A

Breakpoints are points where the website content responds according to the device width, allowing you to show the best possible layout to the user.

42
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 more adaptable in relation to the size of the layout. Pixels are fixed and won’t change.

43
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 the selector at the bottom will take priority as long as the selector names are the same. Source order.