{"id":499,"date":"2023-11-20T22:53:25","date_gmt":"2023-11-20T22:53:25","guid":{"rendered":"https:\/\/javigomez.org\/?p=499"},"modified":"2025-09-29T20:33:55","modified_gmt":"2025-09-29T20:33:55","slug":"grid-manejo-de-grid-en-css","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2023\/11\/20\/grid-manejo-de-grid-en-css\/","title":{"rendered":"Grid &#8211; Manejo de Grid en CSS"},"content":{"rendered":"\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Modalidades de grid<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Tipo de elemento&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>inline-grid&nbsp; Establece una cuadr\u00edcula con \u00edtems en l\u00ednea, de forma equivalente a <strong>inline<\/strong><strong>-block<\/strong>.<\/p>\n\n\n\n<p>grid&nbsp; Establece una cuadr\u00edcula con \u00edtems en bloque, de forma equivalente a <strong>block<\/strong>.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Definir filas y columnas<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Valor&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>grid-template-columns&nbsp; [col1] [col2] &#8230;&nbsp; Establece el SIZE&nbsp; de cada columna (col 1, col 2&#8230;).<\/p>\n\n\n\n<p>grid-template-rows&nbsp; [fila1] [fila2] &#8230;&nbsp; Establece el SIZE de cada fila (fila 1, fila 2&#8230;).<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Unidad fracci\u00f3n restante (fr)<\/mark><\/strong><\/p>\n\n\n\n<p>&nbsp;grid-template-columns: 1fr 1fr;<\/p>\n\n\n\n<p>&nbsp;grid-template-rows: 2fr 1fr;<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Filas y columnas repetitivas<\/mark><\/strong><\/p>\n\n\n\n<p>&nbsp;grid-template-columns: 100px repeat(4, 50px) 200px;<\/p>\n\n\n\n<p>&nbsp;grid-template-rows: repeat(2, 1fr 2fr);<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Funci\u00f3n minmax()<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Funci\u00f3n&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>minmax(min, max)&nbsp; Define un rango entre min y max.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Atajo: La propiedad grid-template<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Valores&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>grid-template&nbsp; none | grid-template-rows \/ grid-template-columns&nbsp; Atajo para definir dimensiones del grid.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Huecos en grid<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>column-gap&nbsp; Establece el&nbsp; de los huecos entre columnas (l\u00edneas verticales).<\/p>\n\n\n\n<p>row-gap&nbsp; Establece el&nbsp; de los huecos entre filas (l\u00edneas horizontales).<\/p>\n\n\n\n<p>gap\u00a0 &lt;row-gap> &lt;columna-gap><\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Propiedades de alineaci\u00f3n<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Valores<\/strong>&nbsp; <strong>Afecta a&#8230;<\/strong><\/p>\n\n\n\n<p>justify-items&nbsp; start | end | center | stretch&nbsp; Elementos eje principal<\/p>\n\n\n\n<p>align-\u00edtems&nbsp; start | end | center | stretch&nbsp; Elementos eje secundario<\/p>\n\n\n\n<p>justify-content&nbsp; start | end | center | stretch | space-around | space-between | space-evenly&nbsp; Contenido eje principal<\/p>\n\n\n\n<p>align-content&nbsp; start | end | center | stretch | space-around | space-between | space-evenly&nbsp; Contenido eje secundario<\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>justify-self&nbsp; Altera la alineaci\u00f3n del \u00edtem hijo en el eje horizontal y la sobrescribe con la indicada.<\/p>\n\n\n\n<p>align-self&nbsp; Altera la alineaci\u00f3n del \u00edtem hijo en el eje vertical y la sobrescribe con la indicada.<\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Valores&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>place-items&nbsp; [align-items] [justify-items]&nbsp; Propiedad de atajo para *-items<\/p>\n\n\n\n<p>place-content&nbsp; [align-content] [justify-content]&nbsp; Propiedad de atajo para *-content<\/p>\n\n\n\n<p>place-self&nbsp; [align-self] [justify-self]&nbsp; Propiedad de atajo para *-self<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Orden de los elementos<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Valor&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>order&nbsp; 0 | NUMBER&nbsp; N\u00famero (peso) que indica el orden de aparici\u00f3n de los \u00edtems.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Grid por \u00e1reas<\/mark><\/strong><\/p>\n\n\n\n<p><strong>Propiedad&nbsp; Valores&nbsp; Descripci\u00f3n<\/strong><\/p>\n\n\n\n<p>grid-template-areas&nbsp; nombre | .&nbsp; Indica la disposici\u00f3n de las \u00e1reas en el grid. Cada texto entre comillas simboliza una fila<\/p>\n\n\n\n<p>grid-area&nbsp; auto | nombre&nbsp; Indica el nombre del \u00e1rea. Se usa sobre \u00edtems hijos del grid.<\/p>\n\n\n\n<p>&nbsp; &nbsp;grid-template-areas: &#8220;head head&#8221;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8220;menu main&#8221;<\/p>\n\n\n\n<p>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;foot foot&#8221;;<\/p>\n\n\n\n<p>&nbsp; .item-1 { grid-area: head; background: blue; }<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Inicio-fin de filas y columnas<\/mark><\/strong><\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p><strong>Propiedad\u00a0               Descripci\u00f3n<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-8cf370e7 wp-block-group-is-layout-flex\">\n<p>grid-column-start&nbsp; Indica en que columna empezar\u00e1 el \u00edtem de la cuadr\u00edcula.<\/p>\n\n\n\n<p>grid-column-end\u00a0   Indica en que columna terminar\u00e1 el \u00edtem de la cuadr\u00edcula.<\/p>\n\n\n\n<p>grid-row-start\u00a0       Indica en que fila empezar\u00e1 el \u00edtem de la cuadr\u00edcula.<\/p>\n\n\n\n<p>grid-row-end\u00a0         Indica en que fila terminar\u00e1 el \u00edtem de la cuadr\u00edcula.<\/p>\n<\/div>\n<\/div>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"GRID\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/kbWkYwgHokk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Modalidades de grid Tipo de elemento&nbsp; Descripci\u00f3n inline-grid&nbsp; Establece una cuadr\u00edcula con \u00edtems en l\u00ednea, de forma equivalente a inline-block. grid&nbsp; Establece una cuadr\u00edcula con &hellip; <\/p>\n","protected":false},"author":1,"featured_media":500,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[26,28,106,171,177,178,179,180,181,182,210,211,236,252],"class_list":["post-499","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css","tag-align-items","tag-aling-content","tag-css","tag-gap","tag-grid","tag-grid-area","tag-grid-column-start","tag-grid-template","tag-grid-template-columns","tag-grid-template-rows","tag-justify-content","tag-justify-items","tag-minmax","tag-order"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=499"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/499\/revisions"}],"predecessor-version":[{"id":924,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/499\/revisions\/924"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media\/500"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}