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

Using . notation ex) .class

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

Using element names ex) h1, h2

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

Using #id ex) #html

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

What CSS properties make up the box model?

A

Border, margin, padding

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

Margin

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

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

A

Row (which goes left to right)

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

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

A

Nowrap

All flex items being in one line

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

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

A

Divs are block elements

And thus makes new blocks

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

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

A

Row - Left to right

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

What is a pseudo-class?

A

specifies a special state of the selected element(s)

Classes applied by the browser on certain conditions

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

What are CSS pseudo-classes useful for?

A

Applying styling as a result of user interaction

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

Name at least two units of type size in CSS.

A

Rem
Pixels
Percentages
point

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

Name three different types of values you can use to specify colors in CSS.

A

RGB values - (values of 0-255)
How much red, green, and blue are used to make it up

Hex codes
6 digit codes that represent red, blue, green in a color preceded by a pound or hash#

Color Names
There are 147 predefined color

17
Q

What are the four components of “the Cascade”.

A

Source order, specificity, inheritance, important rule

18
Q

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

A

Whatever class is coded last within the element, that will be cascaded

19
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

20
Q

List the three selector types in order of increasing specificity.

A

element
class
id

21
Q

Why is using !important considered bad practice?

A

It overrides everything

22
Q

The transition property is shorthand for which four CSS properties?

A

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

23
Q

What does the transform property do?

A

The transform CSS property lets you rotate, scale, skew, or translate an element
Syntax
transform(rotate)

24
Q

Give four examples of CSS transform functions.

A
Matrix
Translate
Scale
Rotate
Skew

translateY() CSS function repositions an element vertically on the 2D plane. Its result is a data type.

25
Q

What is a breakpoint in responsive Web design?

A

The breakpoint is the min-width set on the @media screen

Point where new styling change happens

26
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 automatically sets it for you

27
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

Because of the source order
Media queries are at the bottom because of source order
Because it goes horizontally down.

28
Q

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

A

static: The element is positioned according to the normal flow of the document.

29
Q

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

A

The element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left. (doesn’t affect other elements)

30
Q

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

A

This is very similar to static positioning, except that once the positioned element has taken its place in the normal flow, you can then modify its final position, including making it overlap other elements on the page

31
Q

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

A

The element is removed from the normal document flow, and no space is created for the element in the page layout.

32
Q

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

A

It is positioned relative to its closest positioned ancestor, (nonstatic positioned ancestor)

33
Q

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

A

applying non-static position to it.
(by positioning the ancestor to relative)

If the position property is absolute, the containing block is formed by the edge of the padding box of the nearest ancestor element that has a position value other than static (fixed, absolute, relative, or sticky).

34
Q

What are the four box offset properties?

A

top, bottom, left, right

35
Q

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

A

width, height

36
Q

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

A

The HTML Viewport meta tag