<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="css/grid.css"/> </head> <body> <div id="contenedor"> <div id="primero" class="elemento">1</div> <div id="side" class="elemento">2</div> <div id="content" class="elemento">3</div> <div id="footer" class="elemento">4</div> <!-- <div class="elemento">5</div> <div class="elemento">6</div> <div class="elemento">7</div> <div class="elemento">8</div> <div class="elemento">9</div> <div class="elemento">10</div> --> </div> </body> </html>
.elemento{ border: solid 2px gray; padding: 1em; background-color: aquamarine; } #contenedor{ display: grid; grid-template-columns: 150px 2fr 1fr; /* unidades relativas al espacio libre */ grid-template-rows: 1fr repeat(2,2fr); grid-template-areas: 'header header header header' 'side content content content' 'side content content content' 'side content content content' 'footer footer footer footer' ; } #primero{ grid-area: header; } #side{ grid-area: side; } #content{ grid-area: content; } #footer{ grid-area: footer; }