css Flashcards

1
Q

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

A

Selector and declaration, 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

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, hex codes, color names

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 keyword added to a selector that specifies the state of the element

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 styles to an element in relation to the content of the document tree and external factors
ex) hover, checked, visited, 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

pixels or percentages or rem

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 are the four components of “the Cascade”.

A

Source order, Inheritance, Specificity, and !important

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

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

A

The order in which the style is written, the last ruleset will be applied.

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

The styles can be inherited from the parent from already being an inherited property or by specifying inheritance.

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

List the three selector types in order of increasing specificity.

A

Element name, class, id

17
Q

Why is using !important considered bad practice?

A

Hard to debug because it disrupts natural css cascading.

18
Q

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

A

row, left to right

19
Q

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

A

nowrap

20
Q

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

A

because divs are block elements that take all the horizontal space provided

21
Q

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

A

row ltr

22
Q

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

A

position static

23
Q

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

A

It does not affect the position of surrounding elements.

24
Q

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

A

It moves the element from where it would have been in normal flow.

25
Q

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

A

Other elements flow as if the absolutely positioned element does not 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-first nonstatic parent.

26
Q

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

A

set parent to relative

27
Q

What are the four box offset properties?

A

top, bottom, left, right