Supprimer

Retour à la page précédente
X Confirmer la suppression !

Grid 16/9 Ratio

Grid Layout sur une section en 16/9

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Grid Layout</title>
    <style>
      body {
        margin: 20px 0px;
      }
      header {
        background-color: rgb(230, 230, 230);
      }
      .grid-container {
        margin: 0 auto;
        width: 100%;
        max-width: 1080px;
        /* height: 50vh; */
        /* min-height: 50vh; */
        aspect-ratio: 16 / 9;
        display: grid;
        grid-template-columns: repeat(16, 1fr);
        grid-template-rows: repeat(9, 1fr);
        /* grid-auto-rows: 1fr; */
        /* grid-auto-flow: column; */
        gap: 1px;
      }
      .grid-container > .item {
        background-color: lightblue;
        padding: 1vw;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 1vw;
      }
      .box1 {
        /* <row-start> / <column-start> / <row-end> / <column-end> */
        grid-area: 3 / 2 / 7 / 9;
        background-color: rgba(215, 30, 30, 0.5);
        z-index: 3;
      }
      .box2 {
        grid-area: 4 / 4 / span 4 / span 7;
        background-color: rgba(70, 30, 215, 0.5);
      }
      .box3 {
        grid-area: 6 / 7 / -1 / -2;
        background-color: rgba(30, 215, 147, 0.5);
      }
    </style>
  </head>
  <body>
    <header>
      <section class="grid-container">
        <script>
          for (var i = 1; i <= 144; i++) {
            document.write('<div class="item">' + i + "</div>");
          }
        </script>
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
      </section>
    </header>
  </body>
</html>

Supprimer