CSS keyframe animations let you describe how an element’s styles change over time. Define the stages in a named @keyframes rule, then connect that name to an element with animation properties such as duration, timing, and repetition.
How CSS keyframe animations work
A keyframe animation has two parts: a named sequence of style states and an animation configuration applied to an element. The animation-name property connects the element to the matching @keyframes rule. The browser interpolates between keyframes for properties that support interpolation.
Keyframe percentages mark positions along the animation timeline, not seconds. A 50% keyframe is halfway through the animation’s active duration. A single keyframe can specify several properties.
How to create a CSS keyframe animation
- Choose the element and effect. Add a class to the element you want to animate.
- Write a named
@keyframesrule. Define the starting and ending styles, plus intermediate percentages when the effect needs waypoints. - Apply the animation. Set the animation name and the timing options that suit the effect.
.card {
animation: 600ms ease-out 1 both enter;
}
@keyframes enter {
from {
opacity: 0;
transform: translateY(0.75rem);
}
to {
opacity: 1;
transform: translateY(0);
}
}
Here, enter is the connection between the rule and the element. The duration is 600 milliseconds, the timing function is ease-out, the animation runs once, and both applies its animated styles before and after the active run as specified by the fill mode.
Recommended Free Tools
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
from, to, and percentage keyframes
from is an alias for 0%; to is an alias for 100%. Use percentages when the animation needs intermediate states. For example, a three-stage animation can use 0%, 50%, and 100% to describe its start, midpoint, and finish. Keyframe selectors may appear in any order in the stylesheet; the browser uses their positions on the timeline.
If the rule omits its start or end keyframe, the element’s computed style supplies that endpoint. This is useful when an animation should begin from the element’s current style and return to its original state, but it can also produce a different result than an explicitly specified start or finish.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Properties in keyframes
You can set multiple properties in one keyframe. If a property is omitted at a particular keyframe, it may still interpolate across the animation when possible. A property that cannot be animated in keyframes is ignored for that animation; supported properties in the same rule can still animate. Check that the specific property’s values interpolate as intended rather than assuming every CSS property will produce a smooth change.
Choose animation settings deliberately
The longhand animation properties make each part of the behavior explicit:
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
animation-nameselects the named@keyframesrule.animation-durationsets the active run’s length. Its default is0s; if you omit the duration, the animation may produce no visible change even though animation events can still occur.animation-timing-functioncontrols the pace of change between keyframes.animation-delaypostpones the start.animation-iteration-countcontrols how many times the sequence runs.animation-directioncontrols whether repetitions run forward, backward, or alternate direction.animation-fill-modedetermines whether animation styles apply before the run begins or after it ends. Use it when the element needs to retain an animated state outside the active run.animation-play-statecontrols whether the animation is running or paused.
The shorthand can combine these settings, but make sure it includes a nonzero duration when a visible animation is intended. When reading or editing a shorthand, keep the values easy to map to the named sequence; longhands are clearer when a configuration becomes difficult to scan.
Several animations on one element
Apply multiple animations by separating their values with commas. Keep each animation’s configuration aligned with its corresponding name so the relationship remains understandable when the declaration is maintained later.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Avoid duplicate keyframe names
Duplicate @keyframes rules with the same name do not merge. The last matching rule encountered is used, so accidental duplicate names can silently replace an earlier sequence. Give each sequence a distinctive name and search the stylesheet or build output if an animation unexpectedly uses the wrong stages.
Keyframes or a transition?
Use keyframes when the effect needs intermediate waypoints or control over repetition and direction. A transition is often a more direct fit for a simple change between states. In either case, confirm that the property interpolates as intended, provide an appropriate reduced-motion experience, and evaluate rendering cost in the actual interface.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsBest Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Support reduced-motion preferences
Some motion, especially blinking or flashing, can be problematic for people with vestibular disorders, epilepsy, migraine, or other sensitivities. The prefers-reduced-motion media query lets a site provide fewer animations and transitions to people whose operating system is set to reduce motion. For nonessential motion, a straightforward starting point is:
@media (prefers-reduced-motion: reduce) {
.card {
animation: none;
}
}
Consider whether a static state preserves the information and function conveyed by the animation. A reduced-motion preference does not automatically mean every animation must disappear: motion that is essential to functionality or information may need a carefully considered alternative. Where appropriate, provide a way to pause or disable animation as well.
Consider performance in the target interface
CSS animations are not automatically inexpensive. The cost depends on the animated properties and the work the browser must perform. Animating box-model properties can trigger layout reflow and repaints; transform can be a useful alternative for some effects, but it is not a universal performance guarantee. Profile the page on the devices and in the conditions that matter for the interface rather than assuming a property or animation will always be smooth.
Troubleshoot common animation problems
- Nothing visibly moves: Check that the element’s
animation-nameexactly matches a defined@keyframesname, and that the duration is greater than0s. - The element jumps to an unexpected state: Check for omitted start or end keyframes, which use computed styles, and verify that the intended properties and values are present at the relevant keyframes.
- An earlier animation definition seems ignored: Look for duplicate rules with the same keyframe name. The last matching rule is used rather than merging the rules.
- One property does not animate: Confirm that the property can be animated in keyframes and that its values interpolate as intended. Other supported properties in the same animation may still work.
- The animation feels sluggish or causes jank: Review whether it animates box-model properties that cause layout or repaint work. Consider whether a transform-based effect fits, then profile the real page and target devices.
Or skip the browser setup
If your task is capturing a page rather than building its animation, ScreenshotNeo provides a website screenshot API and MCP server. A single GET request can return an image or PDF. For example, capture a URL as WebP with cURL:
Free tools Windows power users keep installed
One-click scans. No signup required.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs. The free plan includes 1,000 shots a month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

