CSS Flashcards

1
Q

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

A

selector, declaration block, property, 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 at the beginning.

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

name of the element

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 a # (pound sign or hash) at the beginning.

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, Hex codes, color name.

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

Content, borders, margins, and padding.

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

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
10
Q

What are CSS pseudo-classes useful for?

A

Add special effects to some selectors.

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

pixels, percentages, ems

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

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 they are block elements.

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

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

A

Static

17
Q

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

A

It doesn’t affect.

18
Q

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

A

Making the container other position than static.

19
Q

What are the four box offset properties?

A

Left, right, top, bottom.

20
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 is the process by which certain CSS properties on a child HTML element can receive value from a parent element, if no CSS for that property is directly declared on the child element.

21
Q

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

A

If you have more than one rule for an element, and all of them have exactly the same weight, so the last rule will win.

22
Q

What are the four components of “the Cascade”.?

A
    • Source order
    • Inheritance
    • Specificity
    • !important
23
Q

List the three selector types in order of increasing specificity.

A
    • Type selector
    • Class selector
    • Id selector
24
Q

Why is using !important considered bad practice?

A

Because you wouldn’t be respect the cascade properly. You would be overwriting and messing with the specificity.

25
Q

Give four examples of CSS transform functions.

A

Matrix, translate, scale, rotate, skew.

26
Q

What does the transform property do?

A

Lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.

27
Q

The transition property is shorthand for which four CSS properties?

A

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

28
Q

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

A

width

height

29
Q

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

A

width

height

30
Q

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

A

Viewport meta tag.

31
Q

What is a breakpoint in responsive Web design?

A

The points at which a media query is introduced

a point at which the layout will change

32
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

It allows the web pages to be responsive rather than adaptive. The element will grow/shrink as the screen will grow/shrink.
Percentages can scale while pixels will always stay the same size.

33
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

cascade/source order