CSS Flashcards

1
Q

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

A

the selector and the declaration

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

with the period followed by the name

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

n CSS, how do you select elements by their type?

A

with the 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

with the pound sign (#) followed by the name

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, rgba, hsla, hex colors, color name

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 actual content

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

they let you apply style to elements in different states.

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

How to read

table.striped thead > tr

A

rule set for tr elements that are direct children of thead in the table element with the striped class

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

Name at least two units of type size in CSS.

A

pixels , percentage , em , rem

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

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

A

no wrap

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

What are the four components of “the Cascade”.

A

source order, inheritance, specificity, !important

17
Q

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

A

the order they appear in the css style sheet

18
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

19
Q

List the three selector types in order of increasing specificity.

A

type selectors, class selectors, id selectors

20
Q

Why is using !important considered bad practice?

A

it breaks the natural cascading in your style sheets. overrides other declarations

21
Q

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

A

they are block elements that every new one starts on a new line

22
Q

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

A

the default flex-direction is: row

23
Q

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

A

position: static

24
Q

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

A

It does not affect the normal flow of other elements on the page

25
Q

How does setting position: relative on 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.
/it doesn’t affect its position unless you change the position

26
Q

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

A

It affects the other elements as the other elements treat it as if it wasn’t there. The absolute element is treated as if it wasn’t there and the other elements take its position

27
Q

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

A

it now appears on its own layer and can be moved without affecting the other elements around it

28
Q

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

A

by setting the parents position to relative or a non-static position / though depending on what the parent is it changes how the parent shows up on the page

29
Q

What are the four box offset properties?

A

top , bottom , left , right

30
Q

What does the transform property do?

A

it lets you modify the html elements

31
Q

Give four examples of CSS transform functions.

A

rotate, scale, skew, translate

32
Q

The transition property is shorthand for which four CSS properties?

A

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

33
Q

Give two examples of media features that you can query in an @media rule.

A

max-width: min-width / orientation

34
Q

Which HTML meta tag is used in mobile-responsive web pages?

A

meta-viewport tag

35
Q

What is a breakpoint in responsive Web design?

A

CSS breakpoints are points where the website content responds according to the device width

36
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

its more responsive and not fixed / apply to different screen sizes

37
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

it is the last rule as in CSS it is cascading . In that the last rule is the one that wins