Grid Areas Layout

Grid Areas Layout

Hard CSS Grid Layout 17 views
Explanation Complexity

Problem Statement

Create a simple layout using grid-template-areas: header, main, sidebar, footer.

Input Format

No input.

Output Format

Print the HTML+CSS code in one block.

Constraints

Use named areas and place items by area.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use named areas and place items by area.

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>
    .layout { display: grid; gap: 12px; grid-template-areas: 'head head' 'side main' 'foot foot'; grid-template-columns: 220px 1fr; }
    header { grid-area: head; background: #111; color: #fff; padding: 12px; border-radius: 12px; }
    aside { grid-area: side; border: 1px solid #eee; border-radius: 12px; padding: 12px; }
    main { grid-area: main; border: 1px solid #eee; border-radius: 12px; padding: 12px; }
    footer { grid-area: foot; border: 1px solid #eee; border-radius: 12px; padding: 12px; }
  </style>
</head>
<body>
  <div class='layout'>
    <header>meetcode</header>
    <aside>Menu</aside>
    <main>Main content</main>
    <footer>Footer</footer>
  </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>
    .layout { display: grid; gap: 12px; grid-template-areas: 'head head' 'side main' 'foot foot'; grid-template-columns: 220px 1fr; }
    header { grid-area: head; background: #111; color: #fff; padding: 12px; border-radius: 12px; }
    aside { grid-area: side; border: 1px solid #eee; border-radius: 12px; padding: 12px; }
    main { grid-area: main; border: 1px solid #eee; border-radius: 12px; padding: 12px; }
    footer { grid-area: foot; border: 1px solid #eee; border-radius: 12px; padding: 12px; }
  </style>
</head>
<body>
  <div class='layout'>
    <header>meetcode</header>
    <aside>Menu</aside>
    <main>Main content</main>
    <footer>Footer</footer>
  </div>
</body>
</html>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.