Variables With Fallback
CSS
Hard
2 views
Problem Description
Use a CSS variable with a fallback color for a badge.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use var(--x, fallback).
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>
.badge { background: var(--badge-bg, #222); color: #fff; padding: 6px 10px; border-radius: 8px; }
</style>
</head>
<body>
<span class='badge'>New on meetcode</span>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!