{"id":27947,"date":"2019-12-11T00:00:00","date_gmt":"2019-12-10T23:00:00","guid":{"rendered":"https:\/\/blexin.com\/css-grid-best-practices\/"},"modified":"2021-05-20T18:47:05","modified_gmt":"2021-05-20T16:47:05","slug":"css-grid-best-practices","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/","title":{"rendered":"CSS Grid: Best Practices"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" data-attachment-id=\"27933\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/attachment\/image00-18-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&amp;ssl=1\" data-orig-size=\"1024,608\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image00-18\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-27933\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In previous examples, we have seen how to build layouts using as reference numeric values assigned to lines. Now we will explore some Best Practices that help us to simplify our job.<br>The first method is to define names to assign to columns templates and eventually to rows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n.container {\ndisplay: grid;\ngrid-template-rows: 100px 50px 300px 80px;\ngrid-template-columns: repeat(3, &#x5B;container-start] 1fr) 300px &#x5B;container-end];\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">With this method we can use names, we have previously defined, instead of numbers:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n.header {\n\u00a0\u00a0\u00a0\u00a0grid-column: container-start \/ container-end;\n}\n.navbar {\n\u00a0\u00a0\u00a0\u00a0grid-column: container-start \/ container-end;\n}\n.footer {\n\u00a0\u00a0\u00a0\u00a0grid-column: container-start \/ container-end;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The last approach is to assign names to areas: I consider this method not flexible enough, and it can be adapted with difficulties to more significant projects.<br>Using the property:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\ngrid-template-areas\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">I assign names to areas, which are made up of cells groups, as we have seen before. For example, to define the template for&nbsp;<strong>.header<\/strong>, in the&nbsp;<strong>.container<\/strong>&nbsp;selector I assign the name of the area, grouping four cells:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\ngrid-template-areas: &quot;header header header header&quot;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">I recall the template of the area dedicated to the<strong>&nbsp;.header<\/strong>&nbsp;selector using the property:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\ngrid-area: header;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This is the complete example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n.container {\n\u00a0\u00a0\u00a0\u00a0display: grid;\n\u00a0\u00a0\u00a0\u00a0grid-template-rows: 100px 50px 300px 80px;\n\u00a0\u00a0\u00a0\u00a0grid-template-columns: repeat(3, 1fr) 300px;\n\u00a0\u00a0\u00a0\u00a0grid-template-areas: &quot;header header header header&quot;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&quot;navbar navbar navbar navbar&quot;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&quot;content content content sidebar&quot;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&quot;footer footer footer footer&quot;;\n}\n.header {\n\u00a0\u00a0\u00a0\u00a0grid-area: header;\n}\n.navbar {\n\u00a0\u00a0\u00a0\u00a0grid-area: navbar;\n}\n.content {\n\u00a0\u00a0\u00a0\u00a0grid-area: content;\n}\n.sidebar {\n\u00a0\u00a0\u00a0\u00a0grid-area: sidebar;\n}\n.footer {\n\u00a0\u00a0\u00a0\u00a0grid-area: footer;\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">How to adapt the grid to mobile devices without using media queries<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s start with the following markup and its style sheet:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n.container {\n\u00a0\u00a0\u00a0\u00a0display: grid;\n\u00a0\u00a0\u00a0\u00a0grid-template-rows: 100px 50px auto 80px;\n\u00a0\u00a0\u00a0\u00a0grid-template-columns: repeat(3, 1fr) 300px;\n}\n.header {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -1;\n}\n.navbar {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -1;\n}\n.content {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -2;\n\u00a0\u00a0\u00a0\u00a0display: grid;\n\u00a0\u00a0\u00a0\u00a0grid-template-columns: repeat(3, 1fr);\n\u00a0\u00a0\u00a0\u00a0grid-auto-rows: 125px;\n\u00a0\u00a0\u00a0\u00a0gap: 20px;\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0&amp;__item {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0background: orange;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 10px;\n\u00a0\u00a0\u00a0\u00a0}\n}\n.footer {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -1;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Please note that we assigned the value&nbsp;<em>auto<\/em>&nbsp;to define the height of the row, which contains the&nbsp;<strong>.content<\/strong>&nbsp;and the&nbsp;<strong>.sidebar<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\ngrid-template-rows: 100px 50px auto 80px;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This expedient insures that the height of the block will be adaptable to the number of contents contained in it.<br>The goal is to put the<strong>&nbsp;.sidebar<\/strong>&nbsp;under the&nbsp;<strong>.content<\/strong>&nbsp;in the mobile version and to make the blocks contained in&nbsp;<strong>.content<\/strong>&nbsp;arranged based on the width.<br>Let\u2019s modify now the property&nbsp;<strong>grid-template-columns<\/strong>.<br>We will not specify the columns quantity (3), but we will use the property&nbsp;<strong>auto-fit<\/strong>, which will automatically generate traces based on space available.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\ngrid-template-columns: repeat(3, 1fr) 300px;\ngrid-template-columns: repeat(auto-fit, 1fr) 300px;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Furthermore, thanks to the&nbsp;<strong>minmax<\/strong>&nbsp;function, we will specify a&nbsp;<strong>minimum width<\/strong>&nbsp;(300px) and a&nbsp;<strong>maximum one<\/strong>&nbsp;(1fr): on small displays the column width will be then 300px, but on those larger will be 1fr.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n\/* grid-template-columns: repeat(auto-fit, 1fr) 300px; *\/\ngrid-template-columns: repeat(auto-fit, minmax(300px, 1fr));\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We did not define a fixed width for the&nbsp;<strong>.sidebar<\/strong>, which maintains its position because we decided that the&nbsp;<strong>.content<\/strong>&nbsp;should occupy the space between rows&nbsp;<strong>1<\/strong>&nbsp;and&nbsp;<strong>-2<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n.content {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -2;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Regarding blocks contained in<strong>&nbsp;.content<\/strong>, we will delete the specific number of columns in favor of the function&nbsp;<strong>auto-fit<\/strong>, and of the definition of a minimum and a maximum height:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n\/* grid-template-columns: repeat(3, 1fr); *\/\ngrid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The final code will be then as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n.container {\n\u00a0\u00a0\u00a0\u00a0display: grid;\n\u00a0\u00a0\u00a0\u00a0grid-template-rows: 100px 50px auto 80px;\n\u00a0\u00a0\u00a0\u00a0grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0&amp;&gt;* {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0color: #5c5c5c;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 10px;\n\u00a0\u00a0\u00a0\u00a0}\n}\n.header {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -1;\n\u00a0\u00a0\u00a0\u00a0background: coral;\n}\n.navbar {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -1;\n\u00a0\u00a0\u00a0\u00a0background: brown;\n}\n.content {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -2;\n\u00a0\u00a0\u00a0\u00a0background: gray;\n\u00a0\u00a0\u00a0\u00a0display: grid;\n\u00a0\u00a0\u00a0\u00a0grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));\n\u00a0\u00a0\u00a0\u00a0grid-auto-rows: 125px;\n\u00a0\u00a0\u00a0\u00a0gap: 20px;\n\u00a0\u00a0\n\u00a0\u00a0\u00a0\u00a0&amp;__item {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0background: orange;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0color: #ffffff;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 10px;\n\u00a0\u00a0\u00a0\u00a0}\n}\n.sidebar {\n\u00a0\u00a0\u00a0\u00a0background: orangered;\n}\n.footer {\n\u00a0\u00a0\u00a0\u00a0grid-column: 1 \/ -1;\n\u00a0\u00a0\u00a0\u00a0background: brown;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This is the result we obtained:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"581\" data-attachment-id=\"27940\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/attachment\/grid-17-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-17.gif?fit=1265%2C718&amp;ssl=1\" data-orig-size=\"1265,718\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"grid-17\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-17.gif?fit=1024%2C581&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-17.gif?resize=1024%2C581&#038;ssl=1\" alt=\"\" class=\"wp-image-27940\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-17-1024x581.gif 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-17-980x556.gif 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-17-480x272.gif 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Flexbox vs. CSS Grid<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The question which often arises is: what happens to Flexbox now? Actually, the two modules can be used in combination:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>with&nbsp;<strong>CSS Grid<\/strong>&nbsp;we can realize the supporting structure of the layout, and we can define the UI of elements that require simultaneous management of the placement on the two axis x and y<\/li><li><strong>Flexbox<\/strong>, on the other hand, is more suitable for handling a single axis at a time (e.g., navigation menus, vertical or horizontal lists, and so on).<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">To examine this issue in dept, check the&nbsp;<a href=\"https:\/\/drafts.csswg.org\/css-grid\/#intro\" target=\"_blank\" rel=\"noreferrer noopener\">link<\/a>&nbsp;of the w3c specification, where the difference between the two modules is faced in the introduction.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"804\" height=\"408\" data-attachment-id=\"27943\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/attachment\/grid-18-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-18.png?fit=804%2C408&amp;ssl=1\" data-orig-size=\"804,408\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"grid-18\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-18.png?fit=804%2C408&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-18.png?resize=804%2C408&#038;ssl=1\" alt=\"\" class=\"wp-image-27943\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-18.png 804w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/grid-18-480x244.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 804px, 100vw\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There would be so much more to say&nbsp;because the<strong>&nbsp;CSS Grid<\/strong>&nbsp;specification is very wide and evolves continuously. Still, using the techniques we analyzed in this series of articles, we are able to make layouts thanks to&nbsp;<strong>CSS Grid<\/strong>!<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s see which Best Practices we can use with CSS Grid and what will become of Flexbox<\/p>\n","protected":false},"author":196716237,"featured_media":27933,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","inline_featured_image":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[688637524],"tags":[688637456],"class_list":["post-27947","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-css-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CSS Grid: Best Practices - Blexin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Grid: Best Practices - Blexin\" \/>\n<meta property=\"og:description\" content=\"Let\u2019s see which Best Practices we can use with CSS Grid and what will become of Flexbox\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-10T23:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-20T16:47:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"608\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Carmine Alfano\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Carmine Alfano\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/\"},\"author\":{\"name\":\"Carmine Alfano\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/4e2c9e1af52bea3e12948c0fdea323c6\"},\"headline\":\"CSS Grid: Best Practices\",\"datePublished\":\"2019-12-10T23:00:00+00:00\",\"dateModified\":\"2021-05-20T16:47:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/\"},\"wordCount\":576,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image00-18.png?fit=1024%2C608&ssl=1\",\"keywords\":[\"CSS\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/\",\"name\":\"CSS Grid: Best Practices - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image00-18.png?fit=1024%2C608&ssl=1\",\"datePublished\":\"2019-12-10T23:00:00+00:00\",\"dateModified\":\"2021-05-20T16:47:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/4e2c9e1af52bea3e12948c0fdea323c6\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image00-18.png?fit=1024%2C608&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/image00-18.png?fit=1024%2C608&ssl=1\",\"width\":1024,\"height\":608},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/css-grid-best-practices\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS Grid: Best Practices\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/4e2c9e1af52bea3e12948c0fdea323c6\",\"name\":\"Carmine Alfano\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8f226030567f12e6f1c15de5af3ecde7d4c4b654f5837f8bcfd41582d642c05f?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8f226030567f12e6f1c15de5af3ecde7d4c4b654f5837f8bcfd41582d642c05f?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8f226030567f12e6f1c15de5af3ecde7d4c4b654f5837f8bcfd41582d642c05f?s=96&d=identicon&r=g\",\"caption\":\"Carmine Alfano\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/razzullo\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS Grid: Best Practices - Blexin","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:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/","og_locale":"en_US","og_type":"article","og_title":"CSS Grid: Best Practices - Blexin","og_description":"Let\u2019s see which Best Practices we can use with CSS Grid and what will become of Flexbox","og_url":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/","og_site_name":"Blexin","article_published_time":"2019-12-10T23:00:00+00:00","article_modified_time":"2021-05-20T16:47:05+00:00","og_image":[{"width":1024,"height":608,"url":"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&ssl=1","type":"image\/png"}],"author":"Carmine Alfano","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Carmine Alfano","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/"},"author":{"name":"Carmine Alfano","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/4e2c9e1af52bea3e12948c0fdea323c6"},"headline":"CSS Grid: Best Practices","datePublished":"2019-12-10T23:00:00+00:00","dateModified":"2021-05-20T16:47:05+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/"},"wordCount":576,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&ssl=1","keywords":["CSS"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/","url":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/","name":"CSS Grid: Best Practices - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&ssl=1","datePublished":"2019-12-10T23:00:00+00:00","dateModified":"2021-05-20T16:47:05+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/4e2c9e1af52bea3e12948c0fdea323c6"},"breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&ssl=1","width":1024,"height":608},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/css-grid-best-practices\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"CSS Grid: Best Practices"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/4e2c9e1af52bea3e12948c0fdea323c6","name":"Carmine Alfano","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8f226030567f12e6f1c15de5af3ecde7d4c4b654f5837f8bcfd41582d642c05f?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8f226030567f12e6f1c15de5af3ecde7d4c4b654f5837f8bcfd41582d642c05f?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8f226030567f12e6f1c15de5af3ecde7d4c4b654f5837f8bcfd41582d642c05f?s=96&d=identicon&r=g","caption":"Carmine Alfano"},"url":"https:\/\/blexin.com\/en\/author\/razzullo\/"}]}},"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-7gL","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image00-18.png?fit=1024%2C608&ssl=1","_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/27947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716237"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=27947"}],"version-history":[{"count":6,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/27947\/revisions"}],"predecessor-version":[{"id":31957,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/27947\/revisions\/31957"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/27933"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=27947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=27947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=27947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}