html grid 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";
}

Example 3: grid css

.container {
  grid-template-columns: [first] 40px [line2] 50px [line3] auto [col4-start] 50px [five] 40px [end];
  grid-template-rows: [row1-start] 25% [row1-end] 100px [third-line] auto [last-line];
}

Tags:

Html Example