Diseño de Grillas para Páginas Web de Comida
Clase 8 de 13 • Curso de CSS Grid Básico
Contenido del curso
Clase 8 de 13 • Curso de CSS Grid Básico
Contenido del curso
Darwing Steven Sánchez Londoño
César Palma
Rafael Martínez Rodríguez
Leal Brigitte
Guadalupe Monge Barale
Luis Miguel Aponte Rayo
Jerremi Aron Chancan Labajos
David Axel González Flores
Fabio Triana
Joel Dominguez Merino
Reinaldo Mendoza
Andrés Esteban Rodríguez Jiménez
Antonio Mora
José M. Veintimilla
Platzi Team
Paula Andrea Hayle
Remix Zapata
marco antonio
Raúl Adolfo Sánchez Rodríguez
Genaro Flores
Juan Camilo Salazar Rojas
Humberto Delgado
Santiago Rodriguez Chaves
Cristian Acevedo
Diego Edilberto Novoa Cortes
Gueyli Yanalith Velásquez López
Darwin Benitez
Agu Damonte
Vamos por buen camino, has avanzado, espero no te detengas, el camino es largo pero satisfactorio y cuando lleguemos arriba, hincharemos el pecho con orgullo diciendo, SI PUDE.
Tip de maquetación con grid: En una posible grilla ver cual es el elemento más pequeño que tiene que estar en la grilla. A partir del elemento más pequeño determinar el número de filas y columnas a necesitar para maquetar todos los elementos de dicha sección de la web.
Muchas gracias por el tip
Me rete a mi misma e hice el proyecto sin ver los videos de este módulo. Lo hice a 320px ya que estoy manteniendo lo aprendido en el curso de Responsive Design: Mobile First. He aquí el resultado:
Genial. Felicidades :)
Como se llama el tema que usas?
Puse todas las imágenes en una carpeta para que sea mas fácil usarlas https://drive.google.com/drive/folders/1PR4d5rzgdQzdjT2cyWGz2DIWSlDMj27L?usp=sharing comparto el link de google drive
Muchas gracias!
gracias
El proyecto se me muy interesante, siento que tenemos todo el conocimiento para desarrollarlo. Muchas gracias por las practicas que nos dejo en cada clase, sin duda fue el diferenciador para absorber mejor cada concepto. Vamos con todo! 😎
Me impacto verlo al inicio, después cuando puso la grilla encima se me hizo muy simple
Yo lo hice sin ver el resto de clases solo para ver como me quedaba XD
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="./estilos.css"> <title>Grid layout</title> </head> <body> <div class="container"> <div class="item-1"> <h2>Ckeck the best food</h2> <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p> <button>See more details</button> </div> <figure class="item-2"> <img src="https://i.postimg.cc/zD21m9fG/hero.png" alt="plato de comida"> </figure> </div> <h1 class="services">Our services</h2> <div class="container-services"> <img src="https://i.postimg.cc/k5qHRc5H/video.png" alt="video de nuestros platos" class="plate-1"> <img src="https://i.postimg.cc/qR0pRyfB/dish1.png" alt="plato 1" class="plate-2"> <img src="https://i.postimg.cc/Wp5sNd5j/dish2.png" alt="plato 2" class="plate-3"> <img src="https://i.postimg.cc/hPwgmHF5/dish3.png" alt="plato 3" class="plate-4"> <img src="https://i.postimg.cc/MG08hHnC/dish4.png" alt="plato 4" class="plate-5"> </div> <h3 class="menu">Home menu</h4> <div class="menu-container"> <img src="https://i.postimg.cc/15g1yJgc/plate1.png" alt="plato 1"> <img src="https://i.postimg.cc/cH1P2my3/plate2.png" alt="plato 2"> <img src="https://i.postimg.cc/rs3bd2dG/plate3.png" alt="plato 3"> <img src="https://i.postimg.cc/Fsk8MzqT/plate4.png" alt="plato 4"> <img src="https://i.postimg.cc/rw63Mc2M/plate5.png" alt="plato 5"> </div> </body> </html>
CSS
html { font-size: 62.5%; } * { padding: 0; margin: 0; box-sizing: border-box; font-family: sans-serif; } :root { --white: #fff; --main-black: #17202A; --gray-text: #515A5A; --main-orange: #F39C12; --xs: 1.2rem; --s: 1.4rem; --m: 1.6rem; --l: 1.8rem; --xl: 2rem; --xxl: 2.4rem; } body { background: linear-gradient(225deg, #ffffff, #e6e5e5); } .container { background-color: #ffffff; display: grid; margin: 16px; grid-template-columns: repeat(2, 1fr); grid-template-rows: 1fr; padding: 8px; gap: 4px; place-content: center; } .item-1 { display: flex; justify-content: center; align-items: center; flex-direction: column; padding: 4px; } .item-1 h1 { color: var(--main-black); font-size: var(--l); text-align: start; } .item-1 p { color: var(--gray-text); text-align: start; margin: 12px 16px 18px; font-size: var(--s); } .item-1 button { color: var(--white); padding: 8px 16px; background-color: var(--main-orange); border: none; border-radius: 8px; font-weight: bold; } .item-2 img { width: 100%; height: 100%; object-fit: cover; } .services { text-align: center; color: var(--gray-text); margin: 32px 0; } .container-services { margin: 16px; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2,1fr); } .container-services > img { object-fit: cover; width: 100%; height: 100%; } .plate-1 { grid-column: 1 / 3; grid-row: 1 / 3; } .menu { color: var(--main-black); font-size: var(--m); text-align: center; margin: 32px 0; } .menu-container { margin: 16px; display: grid; grid-template-columns: repeat(5, 1fr); } .menu-container > img { object-fit: cover; width: 100%; height: 100%; }
Trate de hacer el proyecto antes de ver las clases, este es mi resultado.
Genial, ¡gran trabajo!
Se ve muy interesante el proyecto, perfecto para el portafolio. Vamo a darle
agradecida con el de arriba. XD
Mi intento se hacer el proyecto antes de ver las clases: Mobile:
Desktop:
Maquetación
_
Acá intentando antes de ver como lo hace la profe a ver que sale :D
Aquí mi resultado
desktop:
mobile:
HTML:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="css/main.css"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" /> <title>Curso de CSS Grid Básico</title> </head> <body> <header></header> <main> <section class="cards"> <h2 class="cards__title">Reto de propiedades de contenedor</h3> <section class="cards__container"> <article class="cards__item"> <p>1</p> </article> <article class="cards__item"> <p>2</p> </article> <article class="cards__item"> <p>3</p> </article> <article class="cards__item"> <p>4</p> </article> <article class="cards__item"> <p>5</p> </article> <article class="cards__item"> <p>6</p> </article> </section> </section> <section class="cards"> <h2 class="cards__title">Propiedades de ubicacion</h3> <section class="cards__images"> <img src="https://images.pexels.com/photos/416160/pexels-photo-416160.jpeg?auto=compress&cs=tinysrgb&w=400" alt="" class="cards__images--item picture1"> <img src="https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg?auto=compress&cs=tinysrgb&w=400" alt="" class="cards__images--item picture2"> <img src="https://images.pexels.com/photos/1870376/pexels-photo-1870376.jpeg?auto=compress&cs=tinysrgb&w=400" alt="" class="cards__images--item picture3"> <img src="https://images.pexels.com/photos/1444321/pexels-photo-1444321.jpeg?auto=compress&cs=tinysrgb&w=400" alt="" class="cards__images--item picture4"> <img src="https://images.pexels.com/photos/290164/pexels-photo-290164.jpeg?auto=compress&cs=tinysrgb&w=400" alt="" class="cards__images--item picture5"> <img src="https://images.pexels.com/photos/2071873/pexels-photo-2071873.jpeg?auto=compress&cs=tinysrgb&w=400" alt="" class="cards__images--item picture6"> <img src="https://images.pexels.com/photos/1643457/pexels-photo-1643457.jpeg?auto=compress&cs=tinysrgb&w=400" alt="" class="cards__images--item picture7"> </section> </section> <section class="introduccion"> <article class="introduccion__info"> <h2>Check the Best Food</h2> <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus non odio, commodi sint sit eligendi!</p> <button>Buy a sale<span class="material-symbols-outlined">arrow_right_alt</span></button> <ul> <img src="./assets/icons/facebook.png" alt=""> <img src="./assets/icons/instagram.png" alt=""> <img src="./assets/icons/tik-tok.png" alt=""> </ul> </article> <picture class="introduccion__image"> <img src="./assets/images/hero.png" alt=""> </picture> </section> <section class="our-service"> <h3>Our service</h3> <section class="our-service__images"> <img class="picture1" src="./assets/images/video.png" alt=""> <img class="picture2" src="./assets/images/dish1.png" alt=""> <img class="picture3" src="./assets/images/dish2.png" alt=""> <img class="picture4" src="./assets/images/dish3.png" alt=""> <img class="picture5" src="./assets/images/dish4.png" alt=""> </section> </section> <section class="home-menu"> <h3>Home menu</h3> <section class="home-menu__images"> <picture> <span class="material-symbols-outlined">favorite</span> <img src="./assets/images/plate1.png" alt=""> </picture> <picture> <span class="material-symbols-outlined">favorite</span> <img src="./assets/images/plate2.png" alt=""> </picture> <picture> <span class="material-symbols-outlined">favorite</span> <img src="./assets/images/plate3.png" alt=""> </picture> <picture> <span class="material-symbols-outlined">favorite</span> <img src="./assets/images/plate4.png" alt=""> </picture> <picture> <span class="material-symbols-outlined">favorite</span> <img src="./assets/images/plate5.png" alt=""> </picture> </section> </section> </main> <footer></footer> </body> </html> ``````js .introduccion { @include flexbox(row, center, center); flex-wrap: wrap; &__info { @include flexbox(column); gap: 1rem; width: 50%; min-width: 30rem; color: $primary-color; h1 { margin: 0; @include font-text(4rem, 600, 4rem); } p { @include font-text(1.5rem, 400, 2rem); } button { @include flexbox(row,center, center); width: 10rem; height: 2rem; border: none; border-radius: 2rem; background-color: $secondary-color; @include font-text(1rem, light, 2rem); color: $fifth-color; span { padding-left: 0.4rem; font-size: 2rem; } } ul { padding: 1rem 0; list-style: none; @include flexbox(row, start, center); gap: 1rem; } } &__image { width: 100%; min-width: 28rem; max-width: 35rem; img { width: 100%; }; } } ``````js .our-service { padding: 2rem; h2 { @include font-text(2.5rem, 700, 3rem); text-align: center; } &__images { margin-top: 2rem; @include grid-container(repeat(auto-fill, minmax(20rem, 30rem)), center, center); @include responsive('small'){ @include grid-container(repeat(4, minmax(7.5rem, 20rem)),repeat(2, 1fr), center, center); grid-template-areas: "picture1 picture1 picture2 picture3" "picture1 picture1 picture4 picture5" ; } gap: 1rem; img { width: 100%; height: 100%; object-fit: cover; } .picture1 { @include responsive('small') { grid-area: picture1; } } .picture2 { @include responsive('small') { grid-area: picture2; } } .picture3 { @include responsive('small') { grid-area: picture3; } } .picture4 { @include responsive('small') { grid-area: picture4; } } .picture5 { @include responsive('small') { grid-area: picture5; } } } } ``````js .home-menu { padding: 2rem; h2 { @include font-text(2.5rem, 700, 3rem); text-align: center; margin-bottom: 2rem; } &__images { @include grid-container(repeat(auto-fit, minmax(6rem, 10rem)), none, center, center); gap: 1rem; picture { position: relative; .material-symbols-outlined { position: absolute; right: 0; top: 0; font-size: 1.5rem; color: $secondary-color; font-variation-settings: 'FILL' 1, } &:nth-child(2) { span{ color: $fourth-color; } } img { width: 100%; height: 100%; } } } }
vamos a por este proyecto les dejo el repositorio en github al final del curso
excelente clase
Diseñando con mobile first:
en este punto les pregunto, ¿es mejor utilizar GRID o FLEXBOX?
Hola Darwin, creo que en este caso se podrian utilizar ambas. Por ej: en el contenedor central (donde estaria el video y los otros cuatro platos) sin dudas que aplicando grid hace muy facil posicionar los elementos en donde los necesitamos. Y en la ultima section (donde esta home menu) con flex box tambien podemos posicionar muy rapido a esas imagenes.