Last active
April 21, 2021 00:51
-
-
Save furenku/c2b373536b34bfae5f6045f32a75432a to your computer and use it in GitHub Desktop.
sitio-dinamico
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| html, body { | |
| /* m0 */ | |
| margin: 0; | |
| /* p0 */ | |
| padding: 0; | |
| } | |
| body > header { | |
| /* w100p */ | |
| width: 100%; | |
| /* h50 */ | |
| height: 50px; | |
| /* p16 */ | |
| padding: 16px; | |
| /* bgc */ | |
| background-color: #333; | |
| /* c */ | |
| color: #fff; | |
| } | |
| .tarjeta { | |
| /* m16 */ | |
| margin: 16px; | |
| /* w320 */ | |
| width: 320px; | |
| /* bxsh */ | |
| box-shadow: 3px 3px 3px rgba(0,0,0,0.3); | |
| } | |
| .tarjeta .imagen, | |
| .tarjeta .imagen img { | |
| /* w100p */ | |
| width: 100%; | |
| } | |
| .tarjeta .nombre, | |
| .tarjeta .info { | |
| /* p16 */ | |
| padding: 16px; | |
| /* m0 */ | |
| margin: 0; | |
| } | |
| .ejemplo { | |
| /* vi */ | |
| visibility: hidden; | |
| /* posa */ | |
| position: absolute; | |
| } | |
| .tarjetas { | |
| display: grid; | |
| /* gtc */ | |
| grid-template-columns: 1fr 1fr 1fr; | |
| justify-items: center; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Sitio dinámico</title> | |
| <!-- link --> | |
| <link rel="stylesheet" href="estilos.css"> | |
| <style> | |
| /* | |
| .contenedor { | |
| margin: 16px; | |
| border: 1px solid #000; | |
| background-color: #f0f0f0; | |
| min-height: 300px; | |
| } | |
| */ | |
| </style> | |
| </head> | |
| <body> | |
| <!-- header --> | |
| <header> | |
| <!-- h1 --> | |
| <h1> | |
| Sitio dinámico | |
| </h1> | |
| </header> | |
| <!-- .contenedor.ejemplo --> | |
| <div class="contenedor ejemplo"> | |
| <!-- article.tarjeta --> | |
| <article class="tarjeta"> | |
| <!-- header --> | |
| <header> | |
| <!-- .imagen --> | |
| <div class="imagen"> | |
| <!-- img --> | |
| <img src="https://unsplash.it/200/200" alt="Imagen falsa"> | |
| </div> | |
| <!-- h3.nombre --> | |
| <h3 class="nombre"> | |
| Nombre de personaje | |
| </h3> | |
| </header> | |
| <!-- .info --> | |
| <div class="info"> | |
| <!-- h5.origen --> | |
| <h5 class="origen"> | |
| Lugar de origen | |
| </h5> | |
| <!-- h5.especie --> | |
| <h5 class="especie"> | |
| Especie | |
| </h5> | |
| <!-- h5.estado --> | |
| <h5 class="estado"> | |
| Estado | |
| </h5> | |
| </div> | |
| </article> | |
| </div> | |
| <!-- .contenedor.tarjetas --> | |
| <div class="contenedor tarjetas"></div> | |
| <script src="tarjetas.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // seleccionar la tarjeta de ejemplo | |
| let tarjetaEjemplo = document.querySelector(".ejemplo .tarjeta") | |
| for( let i=0; i<12; i++ ) { | |
| // voy a copiarla | |
| let nuevaTarjeta = tarjetaEjemplo.cloneNode( true ) | |
| // la voy a pegar muchas veces dentro de la cuadrícula | |
| document.querySelector(".tarjetas").append( nuevaTarjeta ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment