CSS Flashcards

1
Q

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

A

A CSS rule consists of a selector, an opening curly bracket for the declaration block, properties and their associated values, and the closing curly bracket for the declaration bracket.

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

To select a class, you need to use a . character in front of the name of the 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

To select a particular type, you simply write the type name followed by the declaration block.

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

To select an element but its id attribute, you need to use a # character in front of the name of the 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

color, background-color, border-color

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, border, padding, and the content inside 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

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

The pseduo-class is a character (:keyword) that is added to a selector that specifies a special state of the selected 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

It allows you to stylize an element that has a focus placed upon it. Such as hovering over or clicking on an element.

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

px, em

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

Horizontal

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

The default flex-wrap of a flex container is no wrap

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

They vertically stack due to being block-level elements.

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

The default flex-direction is row.

17
Q

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

A

The default value for the position value is: position: static.

18
Q

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

A

It does not affect documents flow but allows you to move the position of an element using offset values.

19
Q

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

A

The element is positioned relative to where it would be in a normal document flow.

20
Q

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

A

Surrounding elements ignore the absolute positioned element. Document flow is unaffected.

21
Q

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

A

The element is placed relative to where it is in its containing element, so make sure the containing element is set to relative also. It will go back to the first HTML element that is not static.

22
Q

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

A

You need to set the containing block to position: relative.

23
Q

What are the four box offset properties?

A

top, left, bottom, right

24
Q

What are the four components of “the Cascade”.

A

Source Order, Inheritance, Specificity, and !imporant

25
Q

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

A

The visual order of the CSS selectors.

26
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 using inheritance

27
Q

List the three selector types in order of increasing specificity.

A
28
Q

Why is using !important considered bad practice?

A
29
Q

What are the four components of “the Cascade”.

A

Source Order, Specificity, Inheritance, and !important

30
Q

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

A

The order that your CSS rules are written in your stylesheet. The styling provided for an element last in your stylesheet is the styling that will ultimately take effect.

31
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

32
Q

List the three selector types in order of increasing specificity.

A

Inline, Id, Class,

33
Q

Why is using !important considered bad practice?

A

Because it has side-effects that mess with CSS’s core mechanism: specificity.

34
Q

What does the transform property do?

A

The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.

35
Q

Give four examples of CSS transform functions.

A

rotate, scale, skew, translate

36
Q

The transition property is shorthand for which four CSS properties?

A

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

37
Q

What is a breakpoint in responsive Web design?

A

A breakpoint in a responsive design is the “point” at which a website’s content and design will adapt in a certain way in order to provide the best possible user experience.

38
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 allows for responsive design when dealing with various display widths.

39
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

Specificity