CSS Flashcards

1
Q

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

A

The selector and the declaration block, which contains properties and 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

.class-name

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 just the element name, ex: h1, p, div

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

id-name

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 Values, Hex Codes, and color names.
-extra-
HSL
HSLA
RGBA
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

The content width and height, padding, border, margin.

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

Margins.

Note: Be aware of margin collapse where the larger top/bottom margin wins.

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 a pseudo-class?

A

It’s 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

CSS pseudo-classes are used to add styles to selectors when those selectors meet certain conditions, whether that’s based on the content of the document tree, or on external factors, ex: position of the mouse (hover)

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

Name at least two units of type size in CSS.

A

Px and percentages
-extra-
ems, ex, and rem

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

The default flex-direction of a flex container is 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

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

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

A

position: static

17
Q

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

A

It does not affect the position of surrounding elements; they stay
in the position they would be in in normal flow. The elements just moves.

18
Q

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

A

Relative positioning moves an element in relation to where it would have been in normal flow, based on the box offset property values.

19
Q

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

A

It is taken out of normal flow, it does not affect the position of any surrounding elements, it’s like it’s not there.

20
Q

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

A

Absolutely positioned elements move as users scroll up and
down the page. It will position itself in relation to the nearest ancestor container it’s in that has a non-static position property.

21
Q

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

A

They constrain themselves to the first non-static containing block, so it must be set to a position property that is relative or it will go up the chain of parents that have a non-static property on it.

22
Q

What are the four box offset properties?

A

Top, bottom, left, right.

23
Q

What are the four components of “the Cascade”.

A

Source order, Inheritance, specificity, and important keyword

24
Q

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

A

The order that your CSS rules are written in your stylesheet.

25
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.

NOTE: The inherit keyword, used as the value of the desired property, or if you want all style properties inherited, the short-had property all with a value of inherit.

26
Q

List the three selector types in order of increasing specificity.

A

Type selector (and pseudo elements), then class selector (and attribute and pseudo-classes), then Id selectors

27
Q

Why is using !important considered bad practice?

A

Because it makes debugging more difficult by breaking the natural cascading in your stylesheets.

28
Q

What does the transform property do?

A

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

29
Q

Give four examples of CSS transform functions.

A

Scale()
Skew()
Rotate()
Translate()

30
Q

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

A

Display-mode, min-width
– Extra –
Hover, pointer, monochrome, orientation, device-width, max-width, width and more.

31
Q

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

A

angle bracket
meta name=”viewport” content=”width=device-width, initial-scale=1”
close angle bracket