CSS Flashcards

(40 cards)

1
Q

what are the individual pieces of a css rule?

A

css selector (element, class, id, etc), declaration block; within declaration block is property and value

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

how to select elements by their class attribute?

A

.class-name {}

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

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

How to select elements by their id?

A

id-name{}

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

Three different types of values to choose color in CSS

A

hexcode, rgb(), hsla, prebaked css color

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

how do you link a css stylesheet to an index html?

A

link href=”location-of-stylesheet.css” rel=”stylesheet” type=”text/css”

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

What is a descendant combinator selector and how do you use it?

A

selects all elements that are descendants of the first element.
parent-element “ [single space] “ child-element {}

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

What is a child combinator selector and how do you use it?

A

only uses direct children of the parent element.

parent-element > child-element {}

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

what css properties make up the box model?

A

margin, padding, border

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

what 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
12
Q

what is a pseudo class?

A

a selector that targets an element in a certain state (being hovered, active, focus)

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

what are pseudo-classes useful for?

A

for selecting targets in a certain state and applying additional properties (e.g. changing the color of a button when hovered)

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

2 types of units that can be used to adjust font-size

A

rem, em , px size

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

what css property controls font used for text?

A

font-family

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

What is a fall-back value for fonts?

A

backup font a browser typically has in case that browser or program does not have that font initially specified (typically serif/sans-serif)

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

Difference between sans-serif and serif?

A

serifs are the extra little flare at the end of letters (e.g. times new roman), refer to all fonts with it , sans-serif do not have the serif (arial)

18
Q

What is the default direction of flex-box?

A

flex-direction: row

19
Q

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

20
Q

what is the difference between justify content and align items?

A

same thing along different axes

21
Q

difference between align items and align content

A

align items affects the single row that all the flex children are in, align content affects all the rows inside the larger container.

22
Q

why do two div elements vertically stack on each other?

A

because they are block level elements; their width is automatically set to 100% of the page so the next block element is automatically bumped below

23
Q

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

24
Q

How does setting position:relative on the element affect document flow

A

does not change document flow

25
How does setting position: relative on an element affect where it appears on the page?
setting position to relative without changing any other property values does not affect where the element appears on the page
26
How does setting position: absolute on a page affect document flow?
It is ignored by the document flow; it's as if it's not there
27
How does setting position absolute on an element affect where it appears on the page?
It goes to the top left corner of the closest non-static (usually relative, absolute) element.
28
How do you constrain an absolutely positioned element to a containing block
set the containing block to anything but static (usually relative/absolute)
29
What are the four box offset properties?
top bottom right left
30
what are the four components of "the cascade"
source order, inheritance, specificity and !important
31
what does the term "source order" mean with respect to css?
assuming the same specificity, in the case an element has been declared a value multiple times, the value last/lower down on the css style sheet is applied.
32
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
some properties are naturally inherited from the parent/ancestor elements
33
list three selector types in order of increasing specificty
type selector, class selector, id selector
34
why is using !important considered bad practice?
breaks the whole "cascade" system by overriding everything, makes it extremely hard to debug; the only thing that compete with !important is another !important
35
what does the transform property do
every css element is place in a coordinate space on the page, transform lets you adjust those coordinates
36
give four examples of css transform functions
matrix, translate, rotate, scale, skew
37
the transition property is shorthand for which four css properties?
transition-property, transition-duration, transition-timing-function, transition-delay
38
what is a breakpoint in responsive Web design
it is a certain point you want the style of your webpage to change at
39
what is the advantage of using percentage instead of a fixed width for a column class in a responsive layout?
It makes it more adaptive in relation to its parent class, if the viewport changes or its viewed on a different device, the column class wont , for example, take up the entire screen as it would if the width were at a fixed pixel count
40
if you introduce css rules for a smaller min-width after the style for a larger min-width, why would the css rules fo r the smaller min-width 'win'?
because of source order - treated with the same specificity as css class selectors