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

.

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 tag name?

A

just the name of the element 4head

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

#

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

What is a pseudo-class?

A

A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s).

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

What are CSS pseudo-classes useful for?

A

used to add styles to selectors, but only when those selectors meet certain conditions. A pseudo class is expressed by adding a colon (:) after a selector in CSS, followed by a pseudo-class such as “hover”, “focus”, or “active”, like this: a:hover { /* your style here */ }

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

Name two types of units that can be used to adjust font-size in CSS.

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

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

A

they’re block elements

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

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

A

row

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

What are the three primary components of a page layout? (Which helper classes do you need?)

A

visual heirarchy, visual flow, grouping/alignment

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

What is the minimum number of columns that you should put in a row?

A

1

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

What is the purpose of a container?

A

easier to organize shiet

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

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

A

move relative to where it normally would exist if it was static

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

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

A

it has no affect on document flow

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

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

A

it don’t

17
Q

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

A

it goes to first non static ancestor

18
Q

What are the four box offset properties?

A
19
Q

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

A

removed from document entirely, so it yolos. goes to nearest layer positioned

20
Q

What are the four components of “the Cascade”.

A

order inheritance specificity !important

21
Q

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

A

whatevers on bottom of stylesheet reigns supreme

22
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

if its an inheritable rule

23
Q

List the three selector types in order of increasing specificity.

A

no value -> type -> class/id

24
Q

Why is using !important considered bad practice?

A

its lame and theres not really a way to future proof help u

25
Q

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

A

min-width and orientation

min-width is prob the one you use most often

the standard for design nowadays is “mobile first”
-what’s easier? moving from a large house to small house, or small house to large house?
–if you design for small first then making bigger is easier
–usually smallest you start at is 320 px

26
Q

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

A

viewport meta

27
Q

What is the event.target?

A

the element where the event originated from

28
Q

Why is it possible to listen for events on one element that actually happen its descendent elements?

A

bubbling

29
Q

What DOM element property tells you what type of element it is?

A

tagName property - ALL UPPERCASE ALL THE TIME FOREVER

why? html was originally in all uppercase… its a relic

30
Q

What does the element.closest() method take as its argument and what does it return?

A

takes the string of a css selector, returns the closest parent to the selector, or null if nothing is found.

Closest is the opposite of querySelector.

31
Q

How can you remove an element from the DOM?

A

element.remove

32
Q

If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?

A
33
Q

What is a breakpoint in responsive Web design?

A

the point at which media queries are introduced

34
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

so it works on all screen sizes

35
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