css grid w3 code example

Example 1: css grid mdn

/* Answer to: "css grid mdn" */

/*
  The grid CSS property is a shorthand property that sets all of
  the explicit grid properties (grid-template-rows,
  grid-template-columns, and grid-template-areas), and all the
  implicit grid properties (grid-auto-rows, grid-auto-columns, and
  grid-auto-flow), in a single declaration.

  For more information, go to:
  https://developer.mozilla.org/en-US/docs/Web/CSS/grid
*/

Example 2: css grid

.item-a {
  grid-area: header;
}
.item-b {
  grid-area: main;
}
.item-c {
  grid-area: sidebar;
}
.item-d {
  grid-area: footer;
}

.container {
  display: grid;
  grid-template-columns: 50px 50px 50px 50px;
  grid-template-rows: auto;
  grid-template-areas: 
    "header header header header"
    "main main . sidebar"
    "footer footer footer footer";
}

Tags:

Misc Example