slide that moves an element from left to right?@keyframes and the steps use from and to or percentages.The correct syntax uses @keyframes followed by the animation name. Inside, you define stages using from and to or percentages like 0% and 100%. Option D uses the correct keyword and stage names.
div {
position: relative;
width: 100px;
height: 100px;
background-color: blue;
animation: fade 2s forwards;
}
@keyframes fade {
from { opacity: 1; }
to { opacity: 0; }
}opacity property in the keyframes.The animation named fade changes the opacity from 1 (fully visible) to 0 (fully transparent) over 2 seconds. The box will fade out.
grow to run only when the user hovers over a button. Which CSS rule correctly applies this?The :hover pseudo-class applies styles when the mouse is over the element. Option A correctly uses button:hover to trigger the animation only on hover.
animation-fill-mode: forwards; affect the element after animation ends?animation-fill-mode: forwards; do after the animation finishes?animation-fill-mode: forwards; keeps the styles from the last keyframe after the animation ends, so the box stays where it moved.
The prefers-reduced-motion media query detects if the user prefers less motion. Option B disables animations for all elements in that case, respecting accessibility.