Skeleton Loading Bar
CSS
Hard
2 views
Problem Description
Create a skeleton bar animation for a loading card.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use a gradient background and background-position animation.
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 shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.line { width: 360px; height: 14px; border-radius: 999px; background: linear-gradient(90deg, #e5e7eb, #f3f4f6, #e5e7eb); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
</style>
</head>
<body>
<div class='line' aria-label='Loading'></div>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!