CSS Flashcards

1
Q

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

A

Selector, declaration block, properties, values

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

.className

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

elementName

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

idName, octothorpe

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

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

A

Hex, rgb, color name, rgba, (HSL, hsla (not used frequently))

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, (content: width and height)

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 class that is applied by the browser to an element in a specific circumstance. They can change the appearance of elements when the user interacts with them.

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

Styling elements based on user actions

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

Percentage, pixels, em, 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 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

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

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

A

Because “div” is a block-level element

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

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

A

row

17
Q

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

A

static

18
Q

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

A

It does not affect document flow

19
Q

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

A

It positions an element relative to where it would normally be in the document flow

20
Q

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

A

It is removed from the document flow entirely

21
Q

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

A

It removes it from the document flow and positions it within the first non-static ancestor

22
Q

How does setting position: fixed on an element affect both document flow and where it appears on the page?

A

It removes it from the document flow just like position: absolute. However, it positions the element in relation to the viewport instead of the first non-static ancestor

23
Q

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

A

Set position: relative; on the containing block

24
Q

What are the four box offset properties?

A

Top, right, bottom, left