Fixed Header Space
CSS
Hard
2 views
Problem Description
Create a fixed header and add padding-top so content is not hidden.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use position: fixed and body padding-top.
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>
body { margin: 0; font-family: system-ui, Arial, sans-serif; padding-top: 56px; }
header { position: fixed; top: 0; left: 0; right: 0; height: 56px; background: #111; color: #fff; display: flex; align-items: center; padding: 0 16px; }
main { padding: 16px; }
</style>
</head>
<body>
<header>meetcode</header>
<main>
<p>This content starts below the fixed header.</p>
</main>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!