CSS Flashcards

1
Q

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

A
Ruleset | Declaration block
selector {
	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 theirclassattribute?

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 { }

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 itsidattribute?

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 - rgb(100,100,90) - express colors in terms of how much red, green, and blue are used to make up it up, 0 - 255
Hex codes - #ee3e80 - six-digit codes that represent the amount of red, green, and blue in a color, preceded by a #
Color names - 147 predefined color names that are recognized by the browser
RGBA, HSL, HSLA

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

Content, padding, border, margin

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 a special state of the selected elements
Pseudo classes are applied by browsers, not written by developers
:hover, :active, :focus, :visited, :checked

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

Lets you apply a style to an element not only in relation to the content of the document tree, but also in relation to eternal factors like that history of the navigator (:visited), the status of its content (:checked), or the position of the mouse (:hover)

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 adjustfont-sizein CSS.

A

Pixels - very precise control over how much space their text takes up Percentages - default size of text in browsers is 16px
Ems - is equivalent to the width of a letter m
Rems - based on root 16px

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 defaultflex-directionof aflexcontainer?

A

flex-direction: row

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

What is the defaultflex-wrapof aflexcontainer?

A

flex-wrap: 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

div elements are block-level element

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

What is the defaultflex-directionof an element withdisplay: flex?

A

row

17
Q

What is thedefaultvalue for thepositionproperty of HTML elements?

A

position: static

18
Q

How does settingposition: relativeon an element affect document flow?

A

Does not affect the position of surrounding elements; they stay in the position they would be in normal flow

19
Q

How does settingposition: relativeon an element affect where it appears on the page?

A

Relative positioning moves an element in relation to where it would have been in normal flow

20
Q

How does settingposition: absoluteon an element affect document flow?

A

It is taken out of normal flow, meaning that it does not affect the position of any surrounding elements (as they simply ignore the space it would have taken up. Positions elements in relation to its containing element.

21
Q

How does settingposition: absoluteon an element affect where it appears on the page?

A

Absolutely positioned elements sits at the top left corner of the nearest ancestor element with position property value set to non static values

22
Q

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

A

Set containing block (ancestor element) to position property: relative
Relative has least amount of repercussion to document flow

23
Q

What are the four box offset properties?

A

top, bottom, left, right

24
Q

What are the four components of “the Cascade”.

A

Source order, specificity, inheritance, importance

25
Q

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

A

When the specificity weight of the rules is the same, then ruleset that comes last in the CSS will win.

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

Inheritance

27
Q

List the three selector types in order of increasing specificity.

A

Element, Class, ID

28
Q

Why is using!importantconsidered bad practice?

A

Overrides cascade

29
Q

What does the transform property do?

A

Lets you rotate, scale, skew, or translate and element, modifies the coordinate space of the CSS visual formatting model

30
Q

Give four examples of CSS transform functions.

A
translate(length-percentage values)
rotate(angle)
scale()
skew()
matrix()
31
Q

Thetransitionproperty is shorthand for which four CSS properties?

A

Transition-delay
Transition-duration
Transition-property
Transition-timing-function

32
Q

What is abreakpointin responsive Web design?

A

The points at which a media query is introduced

33
Q

What is the advantage of using a percentage (e.g.50%)widthinstead of a fixed (e.g.px)widthfor a “column” class in a responsive layout?

A

Percentages will give wiggle room vs fixed width will remain at specified width regardless of the size of the browser

34
Q

If you introduce CSS rules for a smallermin-widthafterthe styles for a largermin-widthin your style sheet, the CSS rules for thesmallermin-widthwill “win”. Why is that?

A

Source order

*Media queries should be at the bottom of the same file as original rule