CSS (Cascading Style Sheets) Flashcards

1
Q

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

A

Selector, Declaration Block, Declaration (which contain property and 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

.

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

the 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

#

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, hex code, and color name (most common 3)

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

Padding, Border, Margin

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

Classes applied by browser under certain circumstances

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

Applied styling as a result of user interaction

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

rem, px, %, pt

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

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

A

row - left to right

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

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

A

nowrap

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

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

A

They are block elements

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

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

A

row - left to right

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

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

17
Q

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

A

It affects its normal document flow

18
Q

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

A

It stays in the same location

19
Q

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

A

Disrupts normal flow and does not affect the position of other elements on the page (they act like it’s not there)

20
Q

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

A

It will inherit it’s ancestor’s position

21
Q

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

A

Set its position value to anything but static

22
Q

What are the four box offset properties?

A

Top, Bottom, Left, Right

23
Q

What are the four components of “the Cascade”.

A

Source Order, Specificity, Inheritance, !important

24
Q

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

A

The styling that comes lower in your stylesheet will take effect over the styling that is higher.

25
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Inheritance
26
List the three selector types in order of increasing specificity.
element --> class --> ID
27
Why is using !important considered bad practice?
It makes it more difficult to debug later on. There has to be a good reason why it's being utilized.
28
What does the transform property do?
Property that lets you rotate, scale, skew, or translate an element.
29
Give four examples of CSS transform functions.
Scale, rotate, translate, matrix
30
The transition property is shorthand for which four CSS properties?
transition-property, transition-duration, transition-timing-function, transition-delay
31
Give two examples of media features that you can query in an @media rule.
min-width and max-width
32
Which HTML meta tag is used in mobile-responsive web pages?
viewport meta tag
33
What is a breakpoint in responsive Web design?
The point where new styling is being applied
34
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?
Much more flexible, maintainable, and easy to use
35
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?
Source order