07-css-transitions-animations Flashcards

(20 cards)

1
Q

What are CSS transitions?

A

A way to control the speed of property changes — instead of being instantaneous, changes happen smoothly over a specified duration.

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

What are the four sub-properties of the transition shorthand?

A

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

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

What does transition-property specify?

A

Which CSS properties should be animated during the transition, e.g. transition-property: opacity, transform.

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

What does transition-duration control?

A

How long the transition takes to complete, e.g. transition-duration: 0.3s.

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

What does transition-timing-function define?

A

The acceleration curve of the transition — e.g. ease, linear, ease-in-out, or a custom cubic-bezier().

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

What does transition-delay do?

A

Sets a waiting period before the transition starts after the property change is triggered.

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

Do transitions require a trigger?

A

Yes — transitions need a state change trigger like :hover, :focus, a class toggle, or a JavaScript property change.

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

Can you animate the auto value with transitions?

A

The spec recommends against it. Browser behavior is inconsistent — some ignore it, others try to interpolate. Avoid animating to/from auto.

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

What is the difference between CSS transitions and CSS animations?

A

Transitions animate between two states and need a trigger. Animations can have multiple keyframes, run automatically, loop, and don’t require a trigger.

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

What is the @keyframes at-rule?

A

It defines the styles at various points during an animation sequence using percentage waypoints (0% to 100%), or the from/to keywords.

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

How do you connect @keyframes to an element?

A

Use the animation-name property with the name of the @keyframes rule, e.g. animation-name: slide-in.

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

What does animation-iteration-count control?

A

How many times the animation repeats. Set to infinite for continuous looping.

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

What does animation-direction do?

A

Controls whether the animation plays forward, backward, or alternates direction each cycle. Values: normal, reverse, alternate, alternate-reverse.

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

What does animation-fill-mode do?

A

Defines styles applied before/after the animation runs. forwards retains the final keyframe styles; backwards applies the first keyframe during the delay; both applies both.

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

What is animation-play-state?

A

Controls whether the animation is running or paused. Useful for toggling animations with JavaScript.

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

Can you combine multiple animations on one element?

A

Yes — use comma-separated values in the animation property, e.g. animation: resize 1.5s, recolor 1.5s.

17
Q

Are !important declarations respected inside @keyframes?

A

No — declarations marked with !important inside keyframe blocks are ignored.

18
Q

If multiple @keyframes rules share the same name, which is used?

A

The last one encountered by the parser wins. @keyframes rules don’t cascade between rule sets.

19
Q

What is the @starting-style at-rule?

A

It defines the initial styles for elements entering the DOM so they can transition from a starting state, solving the problem of no ‘from’ value for new elements.

20
Q

What properties cannot be animated?

A

Properties whose animation type is listed as ‘not animatable’ in the spec, like display (though modern browsers now support transitioning display discretely with some caveats).