selector

keyframe selectors — CSS reference

Keyframe selectors identify positions in an animation, not DOM elements. From and to correspond to 0% and 100%; comma lists can group offsets. Rules at the same offset cascade within the keyframe set.

Formal Syntax & Structure

css syntaxcss
@keyframes fade { from { opacity: 0; } 50% { opacity: .5; } to { opacity: 1; } }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>keyframe selectors</title><style>body{margin:0;background:white}#a{box-sizing:border-box}#a{animation:fade 1s linear paused;animation-delay:-.5s}@keyframes fade{from{opacity:0}50%{opacity:.5}to{opacity:1}}</style><body><div id="a">Example</div></body></html>
CSS Reference