Center with Auto Margin

Center with Auto Margin

Easy CSS Box Model & Sizing 28 views
Explanation Complexity

Problem Statement

Center a fixed-width container for meetcode using margin auto.

Input Format

No input.

Output Format

Print the HTML+CSS code in one block.

Constraints

Use max-width and margin: 0 auto.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use max-width and margin: 0 auto.

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>
    .wrap { max-width: 640px; margin: 0 auto; padding: 16px; border: 1px solid #eee; }
  </style>
</head>
<body>
  <div class='wrap'>
    <h1>meetcode</h1>
    <p>Centered layout container.</p>
  </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>
    .wrap { max-width: 640px; margin: 0 auto; padding: 16px; border: 1px solid #eee; }
  </style>
</head>
<body>
  <div class='wrap'>
    <h1>meetcode</h1>
    <p>Centered layout container.</p>
  </div>
</body>
</html>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.