CSS Flashcards

1
Q

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

A

css selector and declaration block (properties and values)

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 a dot and the class name

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

with the element’s 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

with the # character

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, hex codes, color names

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, padding, border (and content but content is not a property)

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 adds 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 (hover, active, focus, etc) that specifies a special state of the selected element(s)

ex: :hover can be used to change a button’s color when the user’s pointer hovers over it

a keyword that is used to apply a selector to a specific state (certain thing happening in user interaction, history of the navigator– when you click on a link, it turns purple)

a psuedo class is a class apply by a browser to an element in certain situation

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 a style to an element when a specified action (such as hovering) occurs

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

Name at least two units of type size in CSS.

A

px and rem

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

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

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

because div is a block element and it takes up the whole width so the next div has to start on a new line

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 default value for the position property of HTML elements?

A

position: static (normal flow of webpage)

18
Q

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

A

it doesn’t affect the flow, it just overlaps them and shifts the elements

19
Q

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

A

it moves the element relative to the normal placement (ex: position relative top: 10px means offset 10px FROM the top)

20
Q

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

A

the document acts like the element doesn’t exist

21
Q

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

A

its going to affect it where it appears on the page by getting out of the element ? completely and finds the closest nonstatic element

you only use position: absolute when you multiple layers of elements you want to overlay and you want element in a relative container (if you don’t set a relative container, then its going to position within the viewport/html

22
Q

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

A

absolute position element needs to be inside an element that has a position set (such as relative position)

23
Q

What are the four box offset properties?

A

right, left, top, bottom

24
Q

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

A

width and device width

25
Q

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

A

viewport metatag

26
Q

The transition property is shorthand for which four CSS properties?

A

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

27
Q

What does the transform property do?

A

lets you rotate, scale, skew, or translate an element

28
Q

Give four examples of CSS transform functions.

A

translate(), scale(), rotate(), skew()

29
Q

What is a breakpoint in responsive Web design?

A

the point at which media query is used

a mark at some sort where new styling is introduced

30
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

when you miminize or maximize your screen the element will resize up to the percentage you specified at

using percentage allows for more percentage and works with every viewport. you will still have to specify the width for certain viewport but it wont be as many as pixels

percentage possibly provide less styling than pixels

31
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

code at the bottom takes precedence over code above

what we’re dealing with here is source order

media queries are completely reliance on source order to do their job