CSS Flashcards

1
Q

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

A

selector, declaration block, 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 their class attribute?

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

element 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

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

color name, hex code, rgb

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

margin, border, padding, height, width

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
class applied based on an unique state of an element
can only be applied by browser (you cannot write)
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

can add special effects to elements based on user interaction
less work/code needed later on when code becomes complex

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

rems, ems, pixels, percentages

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

row (left to right direction)

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

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

row

17
Q

what is the purpose of the container class for layout classes?

A

to create space for content

18
Q

what is purpose of row class in layout classes?

A

to section off vertical spaces/areas (where content is horizontal)

19
Q

what is purpose of column class for layout classes?

A

to section off horizontal space/area

20
Q

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

A

static (normal document flow)

21
Q

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

A

doesn’t affect the document flow

22
Q

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

A

(with no box offset) appears where it would normally be in static position
(with box offset) moves in relation to where it would have been originally in static position

23
Q

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

A

element is removed from normal flow (perceived to be nonexistent)

24
Q

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

A

appears at top left corner of containing element (the closest/nearest ancestor element that is not static)

(sits at the top of its nearest ancestor that is not static)

25
Q

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

A

make that containing block not static position (relative)

26
Q

What are the four box offset properties?

A

top, bottom, left, right

27
Q

fixed position

A

positioned in relation to viewport of browser

allows us to make an element visible at all times on browser
(chat with representative box, popups to sign in before going into website, navigation bar at the top of page no matter how much you scroll etc.)

28
Q

What are the four components of “the Cascade”.

A

source order, inheritance, specificity , ! important

29
Q

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

A

styling is dependent on the order of css rulesets in stylesheet

process in css of deciding which styling is applied to element dependent on the order of the rulesets in your stylesheets (rulesets lower have more priority

30
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

31
Q

List the three selector types in order of increasing specificity.

A

type/element < class < id

32
Q

Why is using !important considered bad practice?

A

reverses cascade

overrides everything

33
Q

What does the transform property do?

A

modifies the coordinate space of the CSS (on x, y, z plane)

34
Q

Give four examples of CSS transform functions.

A

matrix, translate, scale, rotate

35
Q

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

A

min-width

max-width

36
Q

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

A

viewport meta tag

37
Q

What is a breakpoint in responsive Web design?

A

The points at which a media query is introduced

where the styling changes

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

no matter what the width of parent is, will be the percentage of that width
more adaptable? more wiggle room?

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

because of source order!!

**media queries should ALWAYS be at bottom of stylesheet (in same file as original rule is located)

**source order matters a lot for media queries!! (go in linear order)
default is mobile (smallest width) -> larger width -> even larger width -> etc.