CSS Flashcards

1
Q

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

A

A CSS rule contains two parts: a selector and a declaration.

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

To select elements with a specific class, write a period (.) character, followed by the name of the 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

The CSS type selector matches elements by node name. In other words, it selects all elements of the given type within a document.

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

To select an element with a specific id, write a hash (#) character, followed by the id of the element.

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

In CSS, colors can be specified by using hexadecimal values, color names, and rBGA values.

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 CSS properties that make up the box model are; padding, border, and 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

The CSS property that pushes boxes away from each other is 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

The CSS property that adds space between a box’s content and its border is 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

Pseudo-classes let you apply a style to an element in relation to the content of the document tree, and; external factors like the history of the navigator, the status of its content, or the position of the mouse.

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

In CSS, em and ex are examples of units of type size for text font.

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

The CSS property that controls the font used for the text inside an element is called 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

The default flex-wrap of a flex container is no wrap.

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

Two div elements “vertically stack” on one another by default because a div is a block-level element.

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

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

A

The default flex-direction of an element with display: flex is row.

17
Q

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

A

Static is always the initial value for the CSS property position.

18
Q

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

A

Other content in the document is not affected by position: relative.

19
Q

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

A

The element will move relative to its normal position.

20
Q

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

A

The element is removed from the document flow.

21
Q

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

A

It occupies it’s own layer and can appear on top of other elements.

22
Q

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

A

Set all of its ancestor elements to have a position of static, which is the default value for the CSS property position.

23
Q

What are the four box offset properties?

A

Top, bottom, left, and right.

24
Q

What are the four components of “the Cascade”.

A

The four components of “the Cascade” are; last rule, specificity, importance, and inheritance.

25
What does the term "source order" mean with respect to CSS?
The term “source order” refers to the order in which styling is applied in CSS.
26
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
This is possible because of inheritance.
27
List the three selector types in order of increasing specificity.
Three selector types in order of increasing specificity are; *, h1, p#intro
28
Why is using !important considered bad practice?
It breaks the natural cascade and makes debugging harder
29
What does the transform property do?
It modifies the coordinate space of the CSS visual formatting model.
30
Give four examples of CSS transform functions.
Four CSS transform functions are; rotate, scale, skew, and translate.
31
The transition property is shorthand for which four CSS properties?
It is a shorthand for; transition-property , transition-duration , transition-timing-function , and transition-delay
32
Give two examples of media features that you can query in an @media rule.
Height and width of the viewport
33
Which HTML meta tag is used in mobile-responsive web pages?
Viewport meta tag
34
What is a breakpoint in responsive Web design?
In responsive design, a breakpoint is the “point” at which a website’s content and design will adapt in a certain way in order to provide the best possible user experience.
35
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?
The advantage is consistency in display across devices.
36
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?
Because of the last rule principle of the CSS cascade.