Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a viewport media query when animation should change with the screen or device; use a container query when a reusable component should respond to the space its own container gives it. In either case, provide a reduced-motion or static option with prefers-reduced-motion, and favor effects such as transform and opacity when they suit the design.

Choose the responsive condition first

Responsive animation is motion that adapts to its context while remaining usable at different viewport sizes, component sizes, and motion preferences. Start by identifying what should trigger the change:

  • Viewport or device condition: use a media query. For example, simplify a page-level entrance animation on a narrow screen.
  • Component space: use a container query when the same component may appear in wide and narrow regions regardless of the overall viewport.

Media queries can respond to viewport values and browser or device features. Container queries let styles respond to a containing element’s size. MDN describes media queries as a key part of responsive design and container queries as a way for reusable components to adapt to their container. MDN: using media queries; MDN: container queries.

Build a viewport-responsive animation

This example animates a card with opacity and translation on wider viewports, and uses a shorter, smaller movement on narrow ones. The markup remains understandable if the animation does not run.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.
<article class="card">
  <h2>A responsive card</h2>
  <p>The information is available without animation.</p>
</article>
.card {
  opacity: 0;
  transform: translateY(1rem);
  animation: card-enter 500ms ease-out forwards;
}

@keyframes card-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 40rem) {
  .card {
    animation-duration: 250ms;
    transform: translateY(0.4rem);
  }
}

The breakpoint is an example, not a universal threshold. Choose it based on where the design or motion stops working well, rather than assuming every device in a category has the same width. If the effect is decorative and not needed to understand or use the card, let the reduced-motion rule below offer a still version.

Use a container query for reusable components

A component can sit in a sidebar on a wide page and become full-width on another page. A viewport breakpoint would not necessarily describe its available space. Mark the component’s parent as a query container, then adapt the component at a container width that fits its layout:

.card-region {
  container-type: inline-size;
}

.card {
  opacity: 0;
  animation: card-enter 500ms ease-out forwards;
}

@container (max-width: 24rem) {
  .card {
    animation-duration: 250ms;
  }
}

The query applies based on the container rather than the viewport. Use the container approach only when container size is the real condition; use a viewport media query for page-level or device-feature changes. Check container-query support against the browsers your project targets before relying on it.

Respect reduced-motion preferences

The prefers-reduced-motion media feature can detect when the user or user agent indicates a preference to minimize nonessential movement. It has the values reduce and no-preference. MDN recommends minimizing or removing nonessential movement when the preference is reduced. MDN: prefers-reduced-motion.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

A direct approach is to keep the motion for the default presentation and remove the animation for reduced-motion users:

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

Set the static properties explicitly so the element does not remain at an animation’s initial hidden state when the animation is disabled. Another valid pattern is to make the static state the default and add motion only under (prefers-reduced-motion: no-preference). W3C WAI’s Technique C39 demonstrates these patterns: “The objective of this technique is to allow users to prevent animations (including motion animations) from being displayed on web pages, via the use of the prefers-reduced-motion CSS Media Query.” C39 is an example technique related to WCAG 2.2 Success Criterion 2.3.3, not a mandatory method of conformance. W3C WAI: Technique C39.

Do not remove essential information or functionality with the motion. W3C explains that essential animation is permitted when removing it would fundamentally change information or functionality that cannot be achieved another conforming way. It also distinguishes nonessential animation initiated by user interaction from animation that starts automatically; they are addressed under different WCAG criteria. Movement required to scroll new content into view is part of scrolling, while additional decorative movement is not automatically essential. W3C WAI: Understanding animation from interactions.

Choose properties with rendering costs in mind

Large numbers of animations or unnecessarily elaborate effects can require more processing and degrade performance. Avoid animating properties that require layout or repaint when a suitable alternative works. Changes to dimensions such as width, height, border, and padding, or positional properties such as margin, top, left, and right, can trigger reflow and repaint. For many visual transitions, transform and opacity are better candidates; filter may be appropriate for some effects but should be evaluated for its actual cost.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.
  • Remove movement that does not help users understand state, hierarchy, or feedback.
  • Prefer a short transform or opacity effect over repeatedly changing layout, when the design permits.
  • Keep the number and duration of concurrent animations reasonable for the experience.
  • Do not add will-change preemptively. MDN advises treating it as a last resort for a demonstrated performance problem.

These choices are practical guidance, not a guarantee that every animation will run smoothly on every device. Test the actual effect in the target browser and device range. MDN’s animation guidance discusses both performance costs and the Web Animations API’s connection to CSS animations. MDN: CSS and JavaScript animation performance.

Decide whether CSS or JavaScript should control the motion

CSS is a natural fit for declarative effects tied to styles, states, media queries, or container queries. JavaScript and the Web Animations API are useful when code needs to start, pause, reverse, sequence, or otherwise programmatically control an animation. These are implementation choices, not a rule that CSS is always better: use the simplest mechanism that gives the required control, and keep the reduced-motion presentation available in either approach. For essential DOM animations, MDN recommends CSS where possible rather than JavaScript, while noting that the Web Animations API can connect JavaScript to CSS animations. MDN: animation performance.

Test responsive and reduced-motion states

  1. Check the page at the narrow and wide widths your design supports, plus the component widths that can occur in its actual layouts.
  2. Confirm the animated element is still visible and usable if its animation is disabled or does not run.
  3. Enable reduced motion in the operating system or browser environment, then reload or revisit the page and verify the reduced or static state.
  4. Test interactions that trigger animation separately from motion that starts automatically. Confirm that removing nonessential movement does not hide a state change or remove functionality.
  5. Inspect performance in your target browsers and devices, especially if the page animates many elements or changes layout-related properties.
  6. Verify newer CSS features against the project’s browser support matrix; do not assume one compatibility result applies to every browser or animation API.

Troubleshoot common problems

The element disappears when reduced motion is enabled

If the default style sets opacity: 0 or another hidden initial state, disabling the animation can leave that state in place. Set the visible static values inside the reduced-motion block, such as opacity: 1 and transform: none.

A component responds at the wrong screen width

A viewport query only observes viewport and device conditions. If the component is narrow inside a wide page, use a container query and ensure the relevant ancestor establishes a query container.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

The animation causes visible jank

Reduce unnecessary concurrent effects and inspect which properties are changing. If the animation alters dimensions or layout positions, try a suitable transform or opacity treatment; measure in the target environment rather than assuming a property is cost-free.

The reduced-motion rule appears not to apply

Check the exact media feature spelling and whether the browser or operating system is set to reduce motion. Also inspect cascade order and specificity to ensure a later style is not overriding the reduced state.

A newer CSS feature does not work consistently

Confirm support for the specific feature in every browser in your project’s target matrix. Provide a usable baseline state that does not depend on the enhancement.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need screenshots to inspect how a page looks at different responsive states, ScreenshotNeo can return a screenshot or PDF from one GET request. This is separate from testing reduced-motion behavior: set up and verify the motion preference in your own browser or test environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.

Example cURL request, using a page URL you control or are permitted to capture:

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 or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response includes X-Page-Verdict and X-Billed headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.

Frequently asked questions

Does every animation need to be removed for reduced-motion users?

No. Reduce or remove nonessential movement while preserving essential information and functionality. The appropriate result may be a static state or a less intense effect.

Are container queries a replacement for media queries?

No. They answer different questions: media queries respond to viewport or device conditions, while container queries respond to a containing element’s size.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is will-change a standard fix for animation performance?

No. Use it only as a last resort for a performance issue you have identified, not as a default animation declaration.

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.