Center with Flex

Center with Flex

Easy CSS Flexbox Layout 27 views
Explanation Complexity

Problem Statement

Center a meetcode login box both horizontally and vertically.

Input Format

No input.

Output Format

Print the HTML+CSS code in one block.

Constraints

Use min-height: 100vh and justify/align center.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use min-height: 100vh and justify/align center.

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; }
    .page { min-height: 100vh; display: flex; justify-content: center; align-items: center; }
    .box { width: 320px; padding: 16px; border: 1px solid #eee; border-radius: 14px; }
  </style>
</head>
<body>
  <div class='page'>
    <div class='box'>
      <h1>meetcode</h1>
      <p>Log in</p>
    </div>
  </div>
</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; }
    .page { min-height: 100vh; display: flex; justify-content: center; align-items: center; }
    .box { width: 320px; padding: 16px; border: 1px solid #eee; border-radius: 14px; }
  </style>
</head>
<body>
  <div class='page'>
    <div class='box'>
      <h1>meetcode</h1>
      <p>Log in</p>
    </div>
  </div>
</body>
</html>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.