CSS Flashcards

1
Q

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

A

the selector

opening bracket of the declaration block

properties: values;

closing bracket of the declaration block

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

You select elements by their class attribute with 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

You select elements by their type by using their 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

You select elements by its ID attribute with a #idName

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

hexcode

RGB(red, green, blue)

color presets

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

margins
borders
padding

width and height
the content within the box

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

The margin property

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

Which CSS property adds space between a box’s content and its border?

A

The padding property

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

If two boxes sit on top of one another, what happens?

A

The border of the boxes collapse. The margin will be the larger of the two boxes.

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

What is a pseudo class?

A

They are classes appended to elements in CSS that makes the elements behave differently when interacted with.

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

What are CSS pseudo classes useful for?

A

They’re useful for making a page feel more interactive.

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

What order must pseudo classes be in?

A

:link, :visited, :hover, :focus, :active

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

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

A

rem
pixels (px)
ems
percentages

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

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

A

font-family

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

Which property adds emphasis to text? What two values can it have?

A

font-weight

normal, bold

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

Which property can make font either normal, italic, or oblique?

A

font-style

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

What is the default size of text in browsers?

A

16px

18
Q

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

A

The default flex-direction is “row”

19
Q

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

A

The default flex-wrap is “nowrap”

20
Q

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

A

Because div elements are block elements.

21
Q

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

A

The default flex-direction of an element with display: flex is “row”

22
Q

How do you enable flex context for an elements children?

A

You give their parent (container) a display property with a value of “flex”

display: flex;

23
Q

What does flex-direction do?

A

It establishes the main-axis, defining the direction that flex items are placed within their container.

24
Q

What does flex-wrap do?

A

Flex-wrap makes flex items begin on a new line after taking up all of the available horizontal space

25
Q

What is a utility class?

A

It’s meant to be re-used and the class name describes what it does

26
Q

What is a semantic class?

A

A descriptive class named for what it represents. class=”character” is most likely a placeholder for a character

27
Q

What are the only properties your “container”, “row”, “column” classes have?

A

.container {
max-width: 800px
margin: 0 auto;
}

.row {
display: flex;
}

.column-full {
width: 100%;
}

(fractions as deemed necessary)

.column-half {
width: 50%;
}

28
Q

What is the default value for the position property?

A

static

29
Q

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

A

It doesn’t affect document flow. Surrounding elements will stay in their normal positions.

30
Q

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

A

It moves the element relative to where it WOULD HAVE been in normal flow

31
Q

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

A

The element is removed from document flow and surrounding elements will fill the space

32
Q

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

A

You make it’s container non-static. You set the container’s position to relative

position: relative

33
Q

What are the four box offset properties?

A

top,
right,
bottom,
left

34
Q

What are the four components of “the Cascade”

A

source order
inheritance
specificity

35
Q

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

A

the order that your CSS rules are written

the LAST ruleset written will take precedence over the previous ones

36
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

by inheritance

a parent elements styling will apply to its children

37
Q

What does the transform property do?

A

It allows us to change the positioning of an element by rotating, scale, skew, or translating it

38
Q

Give four examples of CSS transform functions

A

rotate
translate
scale
skew

39
Q

The transition property is shorthand for which four CSS properties?

A

transition-property
transition-duration
transition-timing-function
transition-delay

40
Q

What is a breakpoint in responsive Web design?

A

a point in the viewport width where the styles change

41
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 adapts better

42
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 source order