CSS Flashcards

1
Q

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

A

Selector {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

use a . in front of the element

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

in styles.css

h1 {
}

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

use a # in front 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

RGB Value
Hex Code
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

Border
Margin
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 controls the gap between boxes.

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 specifies how much space is between the contents of an element and its border.

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

What is a pseudo-class?

A

allow you to change the style or appearance of elements when you interact with them.

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

one example is knowing what links you’ve visited by changing the link color from blue to purple once it’s been clicked.

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

rem
ems
px
percentage

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

row - left to right

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 - all flex items will be on one line.

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

div elements are block level elements.

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

ROW / left to right

17
Q

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

A

position: static

18
Q

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

A

it does not affect the position of the surrounding elements.

19
Q

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

A

it moves the element to whatever spot you want it to go. ex-top, left, bottom, right

20
Q

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

A

it is taken out of the document flow essentially, it does not affect surrounding elements, its as if they ignore the space that shouldve been there.

21
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. sit on the top of the nearest parent positioned element.

22
Q

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

A

the element would need a positioned parent element.(not static).

23
Q

What are the four box offset properties?

A

top, bottom, left, right

24
Q

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

A

Selector {property : value;}

25
Q

What are the four components of “the Cascade”.

A

Source Order
Inheritance
Specificity
!important

26
Q

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

A

the order that your css rules are written in the stylesheet.

The styling provided for an element last in your stylesheet is the styling that will ultimately take effect.

27
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

use inheritance because it allows child elements that have no style on it to inherit the style of its parent.

28
Q

List the three selector types in order of increasing specificity.

A
ID - (only ID selectors) 
CLASS - (includes .class selectors, pseudo classes, also attribute selectors like type="radio") 
TYPE - (such as p, h1, td)
29
Q

Why is using !important considered bad practice?

A

Understanding and effectively using specificity and the cascade can remove any need for the !important style.

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

31
Q

Give four examples of CSS transform functions.

A

rotate
translate Y
scale
skew

32
Q

The transition property is shorthand for which four CSS properties?

A

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

33
Q

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

A

min-width and max-width

34
Q

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

A

viewport

35
Q

@Media only media type and media feature

A

you should always specify the media type every time you use @media.

36
Q

What is a breakpoint in responsive Web design?

A

its a point where a style is applied or a boundary.

37
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

depending on how wide your screen is the column will always be 50% of the screen your using.

38
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

the source order.