Reduce Motion Preference
CSS
Hard
3 views
Problem Description
Stop animations when user prefers reduced motion.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use @media (prefers-reduced-motion: reduce).
Official Solution
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>meetcode</title>
<style>
@keyframes bounce { 50% { transform: translateY(-6px); } }
.dot { width: 12px; height: 12px; background: #0b5; border-radius: 50%; display: inline-block; animation: bounce 700ms ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
.dot { animation: none; }
}
</style>
</head>
<body>
<span class='dot'></span>
<span>Loading meetcode</span>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!