{"id":29188,"date":"2017-02-13T21:01:57","date_gmt":"2017-02-13T13:01:57","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=29188"},"modified":"2025-04-03T23:42:44","modified_gmt":"2025-04-03T15:42:44","slug":"css-grid-layout-module","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/","title":{"rendered":"Introduction to the CSS Grid Layout Module"},"content":{"rendered":"<p>It was once <strong>tables<\/strong>, then <strong>margins and floats<\/strong>, then <strong><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/CSS_Flexible_Box_Layout\/Using_CSS_flexible_boxes\" target=\"_blank\" rel=\"noopener\">flexbox<\/a><\/strong> and now <strong>grid<\/strong>: CSS always steered towards new and better ways to ease the age-old job of <strong>coding web layouts<\/strong>. The <strong><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/CSS_Grid_Layout\" target=\"_blank\" rel=\"noopener\">CSS Grid Layout Model<\/a><\/strong> can create and update the layout <strong>along two axes<\/strong>: horizontal and vertical, <strong>affecting both the width and height<\/strong> of elements.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/flexbox-patterns\/\">Flexbox Patterns: The Ultimate CSS Flexbox Code Library<\/a>\n\t\t\t\t<\/p>\n<p>The grid layout doesn\u2019t depend on the position of elements in the markup, hence, you can <strong>shuffle the placements of elements<\/strong> in markup without altering the layout. In the grid model, a grid container element is <strong>divided into grid columns and rows<\/strong> (collectively known as <strong>grid tracks<\/strong>) by <strong>grid lines<\/strong>. Now let\u2019s see how to <strong>create a sample grid<\/strong>.<\/p>\n<h2>Browser support<\/h2>\n<p>As of writing this article, the CSS Grid Module is only supported <a href=\"https:\/\/caniuse.com\/css-grid\" target=\"_blank\" rel=\"noopener\">by the latest IE browser and Edge<\/a> . The CSS Grid is <strong>in experimental stage<\/strong> in the other major browsers in which you have to <strong>enable the support manually<\/strong>:<\/p>\n<ul>\n<li><strong>Firefox:<\/strong> Press <span class=\"key\">Shift<\/span> + <span class=\"key\">F2<\/span>, <strong>enter the following command<\/strong> into the GCLI input bar that appeared at the bottom of the browser: \n    <code>pref set layout.css.grid.enabled true<\/code>.<\/li>\n<li><strong>Chrome:<\/strong> Browse the <code>chrome:\/0\/flags<\/code> URL and enable <code>Experimental Web Platform features<\/code>.<\/li>\n<\/ul>\n<p>All major browser support is likely to <strong>come by early\/mid-2017<\/strong>.<\/p>\n<p class=\"note\"><strong>Recommended Reading:<\/strong>\n  <a href=\"https:\/\/www.hongkiat.com\/blog\/firefox-graphical-command-line\/\">15 Graphical Command Line (GCLI) Commands in Firefox for Front-End Developers<\/a><\/p>\n<h2>A sample grid<\/h2>\n<p>To <strong>turn an element into a grid container<\/strong> you can use <strong>one of these three <code>display<\/code> properties<\/strong>:<\/p>\n<ol>\n<li><code>display: grid;<\/code> \u2013 the element is <strong>converted to a block grid container<\/strong><\/li>\n<li><code>display: inline-grid;<\/code> \u2013 the element is <strong>converted to an inline grid container<\/strong><\/li>\n<li><code>display: subgrid;<\/code> \u2013 if the element is a grid item it is <strong>converted to a subgrid<\/strong> that ignores the grid template and grid gap properties<\/li>\n<\/ol>\n<p>Just as a table is comprised of multiple table cells, a grid is <strong>comprised of multiple grid cells<\/strong>. A grid item is <strong>assigned to a set of grid cells<\/strong> that is collectively known as the <strong>grid area<\/strong>.<\/p>\n<p>We\u2019re going to create <strong>a grid with five sections (grid areas)<\/strong>: top, bottom, left, right and centre. The HTML consists of <strong>five divs inside a container div<\/strong>.<\/p>\n<pre>\r\n&lt;div class=\"grid-container\"&gt;\r\n  &lt;div class=\"grid-top\"&gt;Top&lt;\/div&gt;\r\n  &lt;div class=\"grid-left\"&gt;Left&lt;\/div&gt;\r\n  &lt;div class=\"grid-centre\"&gt;centre&lt;\/div&gt;\r\n  &lt;div class=\"grid-right\"&gt;Right&lt;\/div&gt;\r\n  &lt;div class=\"grid-bottom\"&gt;Bottom&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>In the CSS, the <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-template-areas\" target=\"_blank\" rel=\"noopener\">grid-template-areas<\/a><\/code> property <strong>defines a grid with different grid areas<\/strong>. In its value, <strong>a string represents a grid row<\/strong> and <strong>every valid name within a string represents a column<\/strong>. To <strong>create an empty grid cell<\/strong> you need to use the <strong>dot (<code>.<\/code>) character<\/strong> within a row string.<\/p>\n<p>The <strong>grid area names<\/strong> are to be referenced by the <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-area\" target=\"_blank\" rel=\"noopener\">grid-area<\/a><\/code> property of the individual grid items.<\/p>\n<pre>\r\n.grid-container {\r\n  width: 500px;\r\n  height: 500px;\r\n  display: grid;\r\n  grid-template-areas:  \"top    top    top\"\r\n                        \"left   centre right\"\r\n                        \"bottom bottom bottom\";\r\n}\r\n.grid-top {\r\n  grid-area: top;\r\n}\r\n.grid-bottom {\r\n  grid-area: bottom;\r\n}\r\n.grid-left {\r\n  grid-area: left;\r\n}\r\n.grid-right {\r\n  grid-area: right;\r\n}\r\n.grid-centre{\r\n  grid-area: centre;\r\n}\r\n<\/pre>\n<p>So this code creates <strong>a grid with three rows and columns<\/strong>. The <code>top<\/code> item occupies an area that spans over <strong>three columns in the first row<\/strong> and the <code>bottom<\/code> item spans over <strong>three columns in the last row<\/strong>. Each of the <code>left<\/code>, <code>centre<\/code> and <code>right<\/code> items takes <strong>one column in the middle row<\/strong>.<\/p>\n<p>Now we need to <strong>assign dimensions<\/strong> to these rows and columns. The <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-template-columns\" target=\"_blank\" rel=\"noopener\">grid-template-columns<\/a><\/code> and <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-template-rows\" target=\"_blank\" rel=\"noopener\">grid-template-rows<\/a><\/code> properties <strong>define the size of the grid track<\/strong> (row or column).<\/p>\n<pre>\r\n.grid-container {\r\n  width: 500px;\r\n  height: 500px;\r\n  display: grid;\r\n  grid-template-areas: \"top    top    top\"\r\n                       \"left   centre right\"\r\n                       \"bottom bottom bottom\";\r\n  grid-template-columns: 100px auto 100px;\r\n  grid-template-rows: 50px  auto 150px;\r\n}\r\n<\/pre>\n<p>This is how our CSS grid looks now (with some additional styles):<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid.jpg\" alt=\"CSS Grid\" width=\"800\" height=\"800\"><figcaption>IMAGE: The Grid<\/figcaption><\/figure>\n<h2>Space between grid items<\/h2>\n<p>You can add <strong>blank space between columns and rows<\/strong> using <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-column-gap\" target=\"_blank\" rel=\"noopener\">grid-column-gap<\/a><\/code> and <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-row-gap\" target=\"_blank\" rel=\"noopener\">grid-row-gap<\/a><\/code>, or their longhand property <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-gap\" target=\"_blank\" rel=\"noopener\">grid-gap<\/a><\/code>.<\/p>\n<pre>\r\n.grid-container {\r\n  width: 500px;\r\n  height: 500px;\r\n  display: grid;\r\n  grid-template-areas: \"top    top    top\"\r\n                       \"left   centre right\"\r\n                       \"bottom bottom bottom\";\r\n  grid-template-columns: 100px auto 100px;\r\n  grid-template-rows: 50px  auto 150px;\r\n  grid-gap: 5px 5px;\r\n}\r\n<\/pre>\n<p>Below you can see that the <code>grid-gap<\/code> property added gaps between the grid items indeed.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-gap.jpg\" alt=\"Grid with space\" width=\"800\" height=\"800\"><figcaption>Image: Grid with space between tracks<\/figcaption><\/figure>\n<h2>Align grid content and items<\/h2>\n<p>The <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/justify-content\" target=\"_blank\" rel=\"noopener\">justify-content<\/a><\/code> property of the grid container (<code>.grid-container<\/code>) aligns the content of the grid <strong>along the inline axis (horizontal axis)<\/strong> and the property <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/align-content\" target=\"_blank\" rel=\"noopener\">align-content<\/a><\/code>, aligns a grid\u2019s content <strong>along the block axis (vertical axis)<\/strong>. Both properties <strong>can have one of these values<\/strong>: <code>start<\/code>, <code>end<\/code>, <code>center<\/code>, <code>space-between<\/code>, <code>space-around<\/code> and <code>space-evenly<\/code>.<\/p>\n<p>Where applicable, the track (row or column) size <strong>shrinks to fit the content<\/strong> when aligned. Take a look at the screenshots of grid contents <strong>aligned with different values<\/strong> below.<\/p>\n<h3><code>justify-content: start;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-justify-content-start.jpg\" alt=\"Grid with justify-content:start\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>justify-content: end;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-justify-content-end.jpg\" alt=\"Grid with justify-content: end\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>justify-content: center;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-justify-content-center.jpg\" alt=\"Grid with justify-content: center\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>justify-content: space-between;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-justify-content-spacebw.jpg\" alt=\"Grid with justify-content: space-between\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>justify-content: space-around;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-justify-content-spacear.jpg\" alt=\"Grid with justify-content: space-around\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>justify-content: space-evenly;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-justify-content-spaceev.jpg\" alt=\"Grid with justify-content: space-evenly\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>align-content: start;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-align-content-start.jpg\" alt=\"Grid with align-content: start\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>align-content: end;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-align-content-end.jpg\" alt=\"Grid with align-content: end\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>align-content: center;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-align-content-center.jpg\" alt=\"Grid with align-content: center\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>align-content: space-between;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-align-content-spacebw.jpg\" alt=\"Grid with align-content: space-between\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>align-content: space-around;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-align-content-spacear.jpg\" alt=\"Grid with align-content: space-around\" width=\"800\" height=\"800\"><\/figure>\n<h3><code>align-content: space-evenly;<\/code><\/h3>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid-align-content-spaceev.jpg\" alt=\"Grid with align-content: space-evenly\" width=\"800\" height=\"800\"><\/figure>\n<p>Both the <code>justify-content<\/code> and <code>align-content<\/code> properties <strong>align the entire content within a grid<\/strong>.<\/p>\n<p>To <strong>align individual items within their grid areas<\/strong>, use the <strong>other pair of alignment properties<\/strong>: <code><a href=\"https:\/\/www.w3.org\/TR\/css-align-3\/#justify-items-property\" target=\"_blank\" rel=\"noopener\">justify-items<\/a><\/code> and <code><a href=\"https:\/\/www.w3.org\/TR\/css-align-3\/#align-items-property\" target=\"_blank\" rel=\"noopener\">align-items<\/a><\/code>. Both can have one of these value: <code>start<\/code>, <code>end<\/code>, <code>center<\/code>, <code>baseline<\/code> (align items along the base grid line of the area) and <code>stretch<\/code> (items fill their entire area).<\/p>","protected":false},"excerpt":{"rendered":"<p>It was once tables, then margins and floats, then flexbox and now grid: CSS always steered towards new and better ways to ease the age-old job of coding web layouts. The CSS Grid Layout Model can create and update the layout along two axes: horizontal and vertical, affecting both the width and height of elements.&hellip;<\/p>\n","protected":false},"author":145,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[507,4319,4501],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Introduction to the CSS Grid Layout Module - Hongkiat<\/title>\n<meta name=\"description\" content=\"It was once tables, then margins and floats, then flexbox and now grid: CSS always steered towards new and better ways to ease the age-old job of coding\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to the CSS Grid Layout Module\" \/>\n<meta property=\"og:description\" content=\"It was once tables, then margins and floats, then flexbox and now grid: CSS always steered towards new and better ways to ease the age-old job of coding\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-13T13:01:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T15:42:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid.jpg\" \/>\n<meta name=\"author\" content=\"Preethi Ranjit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Preethi Ranjit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/\"},\"author\":{\"name\":\"Preethi Ranjit\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\"},\"headline\":\"Introduction to the CSS Grid Layout Module\",\"datePublished\":\"2017-02-13T13:01:57+00:00\",\"dateModified\":\"2025-04-03T15:42:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/\"},\"wordCount\":660,\"commentCount\":11,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-grid-layout-module\\\/grid.jpg\",\"keywords\":[\"CSS\",\"CSS Grid Layout\",\"CSS Tutorials\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/\",\"name\":\"Introduction to the CSS Grid Layout Module - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-grid-layout-module\\\/grid.jpg\",\"datePublished\":\"2017-02-13T13:01:57+00:00\",\"dateModified\":\"2025-04-03T15:42:44+00:00\",\"description\":\"It was once tables, then margins and floats, then flexbox and now grid: CSS always steered towards new and better ways to ease the age-old job of coding\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-grid-layout-module\\\/grid.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-grid-layout-module\\\/grid.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-grid-layout-module\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction to the CSS Grid Layout Module\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\",\"name\":\"Preethi Ranjit\",\"description\":\"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/preethi\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Introduction to the CSS Grid Layout Module - Hongkiat","description":"It was once tables, then margins and floats, then flexbox and now grid: CSS always steered towards new and better ways to ease the age-old job of coding","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to the CSS Grid Layout Module","og_description":"It was once tables, then margins and floats, then flexbox and now grid: CSS always steered towards new and better ways to ease the age-old job of coding","og_url":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2017-02-13T13:01:57+00:00","article_modified_time":"2025-04-03T15:42:44+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid.jpg","type":"","width":"","height":""}],"author":"Preethi Ranjit","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Preethi Ranjit","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/"},"author":{"name":"Preethi Ranjit","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3"},"headline":"Introduction to the CSS Grid Layout Module","datePublished":"2017-02-13T13:01:57+00:00","dateModified":"2025-04-03T15:42:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/"},"wordCount":660,"commentCount":11,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid.jpg","keywords":["CSS","CSS Grid Layout","CSS Tutorials"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/","url":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/","name":"Introduction to the CSS Grid Layout Module - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid.jpg","datePublished":"2017-02-13T13:01:57+00:00","dateModified":"2025-04-03T15:42:44+00:00","description":"It was once tables, then margins and floats, then flexbox and now grid: CSS always steered towards new and better ways to ease the age-old job of coding","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-grid-layout-module\/grid.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-module\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Introduction to the CSS Grid Layout Module"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3","name":"Preethi Ranjit","description":"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.","url":"https:\/\/www.hongkiat.com\/blog\/author\/preethi\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-7AM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/145"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=29188"}],"version-history":[{"count":2,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29188\/revisions"}],"predecessor-version":[{"id":73467,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/29188\/revisions\/73467"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=29188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=29188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=29188"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=29188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}