CSS Flashcards

1
Q

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

A

rule set –> 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

.selector

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

selector

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

selector

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() hsl() hex

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

margin border padding height width

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

what does height and width affect for border proeprties

A

content

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

Which CSS property pushes boxes away from each other?

Which CSS property add space between a box’s content and its border?

A

Margin, padding

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

What is a pseudo-class?

A

keyword added to a selector that specifies a special state of the selected element(s) … hover… active… focus..

selector: pseudo-class { declaration block }

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

let you apply a style to an element with relation to external factors like interaction

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

px em %

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

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

A

Wrap

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

flexbox components

A

container and items inside

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 divs are block elements and take up a whole width and creates new lines in terms of document flow

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

flexbox properties that affect the container and what do they do

A

display: flex : defines a flex container,
flex-direction: specifies direction of flex (row, row-reverse, column, column-reverse,
flex-wrap: allows items to be put in multiple lines,
flex-flow: shorthand for previous two,
justify-content: defines the alignment along the main axis,
align-items: justify content version for cross axis,
align-content: aligns the containers lines,
gap: controls the space between flex items

18
Q

flexbox properties affecting items in container and what do they do

A

order: controls item order,
flex-grow: increases item size compared to other items,
flex-shrink: shrink item size,
flex-basis: control sizing of items,
flex: shorthand for previous three flex-,
align-self: allows the default alignment (or the one specified by align-items) to be overridden for individual flex items

19
Q

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

A

position: static;

19
Q

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

A

same document flow as if static but can change position relative to original place with top bottom left right property with some value.

20
Q

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

A

position absolute becomes almost like a floating entity and is ignored by the document flow.
position can be changed through top bottom left right property and some value

21
Q

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

A

can use position relative as parent and have it “floating” in the relative block element and change direction with t b l r properties.

22
Q

What are the four components of “the Cascade”.

A

source order, inheritance, specificity, !important

23
Q

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

A

the order of the class list that is applied to the element

24
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 if the css property allows it

25
Q

List the three selector types in order of increasing specificity.

A
type selector
class selector
id selector
26
Q

Why is using !important considered bad practice?

A

disrupts cascading

27
Q

The transition property is shorthand for which four CSS properties?

A

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

28
Q

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

A

min-width

max-width

29
Q

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

A

viewport meta tag

30
Q

@media syntax?

A

@media ~only media-type ~and (media-feature: value) {
css rule set
}

31
Q

What is the affect of setting an element to display: none?

A

it does not show anything for that element

32
Q

What is a breakpoint in responsive Web design?

A

points at which a media query is introduced are known as breakpoints. where media query changes trigger the css rule inside –>

setting min-width and such,

33
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 is flexible to the size of the parent element and changes along with it. depending on the current screen size

34
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 cascading rule that last rule will take precedent over the ones before it.