CSS Flashcards

1
Q

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

A

Selector { declaration (declaration has a property: value pair) }

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

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

A

Write the list of tags you want to target separated by commas.

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

Keywords, RGB Values (either as CSV or hexadecimal), and HSL (height, saturation, lightness)

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, 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 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 box-sizing “border-box”?

A

This prevents the box from stretching beyond the size you want — instead shrinks content

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

True or False: Padding and margin are the preferred way to center content on the page.

A

False — they should only be used for small moves! (Like giving text in an input box space)

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

What is a pseudo-class?

A

Add style to selectors that only activate under certain conditions to change state or position

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

What are CSS pseudo-classes useful for?

A

Increasing usability of your webpage

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

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

A

Px, em, rem, %

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

What is the different between rem and em?

A

rem is based on the root document size (1rem = 16px) but ‘em checks most direct parent

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

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

A

row — justify content works on the horizontal axis

17
Q

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

18
Q

• Justify content works on the _______ axis, and align items works on the __________ axis.

A

Primary, secondary.

19
Q

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

A

Div elements are block elements by default

20
Q

What are the four components of “the Cascade”

A

Source order, inheritance, specificity, and !important

21
Q

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

A

The order that rulesets appear in the style sheet

22
Q

How is it possible for the styles of an element to be applied to its children as well without additional CSS rules?

A

Inheritance!

23
Q

List the three selector types in order of increasing specificity.

A

Type, class, id

24
Q

Why is using !important considered bad practice?

A

Typically you can achieve what you’re trying to do through source order

25
What does the transform property do?
Lets you visually change the alignment of an element.
26
Give four examples of CSS transform functions.
Translate, scale, rotate, skew
27
Give two examples of media features that you can query in an @media rule.
Max/min width, orientation, pixel-sizes, …
28
Which HTML tag is used in mobile-responsive web pages?
The meta tag with name=viewport
29
The transition property is shorthand for what 4 properties?
transition-property, transition-duration, transition-timing-function, & transition-delay
30
What is a breakpoint in reponsive web design?
Widths that cause content to “break” in some way — like being far too long or too squished
31
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?
Percentages will scale with the screen as it changes, pixels won’t
32
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?
CSS rules are applied in order from top to bottom of the code!