Dev Helpers
← Back

Name grid areas for a simple layout

Name grid areas for a simple layout with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo {
    display: grid;
    grid-template-areas: "header header" "aside main";
    gap: 0.5rem;
  }
  .demo > :first-child {
    grid-area: header;
  }
  .demo > :nth-child(2) {
    grid-area: aside;
  }
  .demo > :last-child {
    grid-area: main;
  }
</style>
<div class="demo">
  <span class="tile">Header</span><span class="tile">Aside</span
  ><span class="tile">Main</span>
</div>