Fixed Header Space

Fixed Header Space

Hard CSS Box Model & Sizing 21 views
Explanation Complexity

Problem Statement

Create a fixed header and add padding-top so content is not hidden.

Input Format

No input.

Output Format

Print the HTML+CSS code in one block.

Constraints

Use position: fixed and body padding-top.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use position: fixed and body padding-top.

Examples

Input:
Output:
(HTML+CSS code)

Example Solution (Public)

CSS
<!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>

Official Solution Code

<!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>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.