Create grid template

Report a typo

Write CSS code to create a 2x2 grid layout with the following cell distribution. You have to use only the grid-template and grid-area CSS properties to complete this task.

  • The first row should have 2 cells of the area named header with a size of 50px each.
  • The second row should have 2 cells of the area named main with a size of 100px each.
  • The third row should have 2 cells of the area named footer with the size of 30px each.
  • The first column (30px) should be half of the second column.
Write HTML and CSS code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Grid template</title>
</head>

<body>
<div class="grid-container">
<div class="item-1">Item 1</div>
<div class="item-2">Item 2</div>
<div class="item-3">Item 3</div>
</div>
</body>
</html>

Completed 1 of 5
Use grid template to create the layout as mentioned in description.
Assign first item to the header grid area.
___

Create a free account to access the full topic