CSS Flashcards

1
Q

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

A

Selector and Declaration

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

What CSS properties make up the box model?

A

border, margin, and padding

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

What is a pseudo-class?

A

A selector that attracts elements in special state such as hover or focus. It is something the browser does.

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

What are CSS pseudo-classes useful for?

A

Let us write less code for styling.

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

Name at least two units of type size in CSS.

A

pixels, percentages, ems

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

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

A

nowrap, all items will try to fit on one line

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

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

A

Because they are block elements

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

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

A

row

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

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

A

Static

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

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

A

It moves the item it was applied to, but doesn’t affect the rest of the document flow.

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

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

A

It makes the element get positioned relative to where it would be in the normal document flow.

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

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

A

Surrounding elements ignore the space the absolute positioned element would have taken up. The absolute item no longer has a place in the document flow.

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

17
Q

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

A

set position of containing element relative to the current element

18
Q

What are the four box offset properties?

A

top, right, bottom, left

19
Q

What are the four components of “the Cascade”.

A

Source Order, Inheritance, Specificity, & !important

20
Q

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

A

Source order is, simply put, 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.

21
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 is the process by which certain CSS properties on a child HTML element can receive value from a parent element, if no CSS for that property is directly declared on the child element.

22
Q

List the three selector types in order of increasing specificity.

A

Type, Class, ID

23
Q

Why is using !important considered bad practice?

A

It causes issues with debugging by breaking the natural cascade of style sheet

24
Q

What is a breakpoint in responsive Web design?

A

The points at which a media query is introduced are known as breakpoints.

25
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

You don’t have to know the pixel count for every screen size.

It is called fluid design.

26
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

CSS Source Order picks whatever is last in document