{"id":130,"date":"2020-12-19T21:48:00","date_gmt":"2020-12-19T21:48:00","guid":{"rendered":"https:\/\/seimith.io\/?p=130"},"modified":"2024-07-20T00:14:49","modified_gmt":"2024-07-20T00:14:49","slug":"split-sections-with-css-grid-with-no-floats","status":"publish","type":"post","link":"https:\/\/seimith.io\/pt\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/","title":{"rendered":"Split sections with CSS Grid with NO floats"},"content":{"rendered":"<p>Parent container\u2019s CSS #1 &#8211; This will split things 50\/50<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/determined-mcnulty-44b4a3.netlify.app\/static\/a198f41d024b90c66eb3233de464f51e\/f058b\/1.png\" alt=\"CSS Grid\" title=\"CSS Grid\"\/><\/figure>\n\n\n\n<p><a href=\"https:\/\/determined-mcnulty-44b4a3.netlify.app\/static\/a198f41d024b90c66eb3233de464f51e\/133ae\/1.png\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div class=&quot;parent&quot;&gt;\n  &lt;div class=&quot;child&quot;&gt;Child #1&lt;\/div&gt;\n  &lt;div class=&quot;child&quot;&gt;Child #2&lt;\/div&gt;\n&lt;\/div&gt;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code> .parent {\n  padding: 1em;\n  background-color: pink;\n  display: grid;\n  grid-template-columns: 50% 50%; \/\/ same as: grid-template-columns: repeat(2, 50%);\n}\n\n.child {\n  background-color: lightblue;\n  border: 1px solid black;\n}<\/code><\/pre>\n\n\n\n<p>However, if you want to add space inbetween these columns with&nbsp;<code>column-gap: 1em<\/code>, your right child container will get pushed off to the side, which might not be desirable.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/determined-mcnulty-44b4a3.netlify.app\/static\/e8603457c5da45e910b2bdb57ac78186\/f058b\/2.png\" alt=\"CSS Grid\" title=\"CSS Grid\"\/><\/figure>\n\n\n\n<p><a href=\"https:\/\/determined-mcnulty-44b4a3.netlify.app\/static\/e8603457c5da45e910b2bdb57ac78186\/e515d\/2.png\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.parent {\n  padding: 1em;\n  background-color: pink;\n  display: grid;\n  grid-template-columns: 50% 50%;\n  column-gap: 1em; \/\/ &lt;-- Looks uggos\n}\n\n.child {\n  background-color: lightblue;\n  border: 1px solid black;\n}<\/code><\/pre>\n\n\n\n<p>Parent container\u2019s CSS #2 &#8211; This will split things 50\/50 and you can add space inbetween WITHOUT pushing things off to the side.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/determined-mcnulty-44b4a3.netlify.app\/static\/c16fbddd0f674eb6a802ff08ad9bcd8e\/f058b\/3.png\" alt=\"CSS Grid\" title=\"CSS Grid\"\/><\/figure>\n\n\n\n<p><a href=\"https:\/\/determined-mcnulty-44b4a3.netlify.app\/static\/c16fbddd0f674eb6a802ff08ad9bcd8e\/e515d\/3.png\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.parent {\n  padding: 1em;\n  background-color: pink;\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  \/\/grid-template-columns: repeat(2, 1fr);\n  column-gap: 1em;\n}\n\n.child {\n  background-color: lightblue;\n  border: 1px solid black;\n}<\/code><\/pre>\n\n\n\n<p>TLDR: These things produce similar results, but they\u2019re not the same.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grid-template-columns: 50% 50%;<\/code><\/pre>\n\n\n\n<p>is not the same as<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grid-template-columns: 1fr 1fr;\ngrid-template-columns: repeat(2, 1fr);<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>Parent container\u2019s CSS #1 &#8211; This will split things 50\/50 However, if you want to add space inbetween these columns with&nbsp;column-gap: 1em, your right child container will get pushed off to the side, which might not be desirable. Parent container\u2019s CSS #2 &#8211; This will split things 50\/50 and you can add space inbetween WITHOUT [&hellip;]<\/p>","protected":false},"author":1,"featured_media":288,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20],"class_list":["post-130","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-post","tag-code"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Split sections with CSS Grid with NO floats - S(ei)mith.io<\/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:\/\/seimith.io\/pt\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Split sections with CSS Grid with NO floats - S(ei)mith.io\" \/>\n<meta property=\"og:description\" content=\"Parent container\u2019s CSS #1 &#8211; This will split things 50\/50 However, if you want to add space inbetween these columns with&nbsp;column-gap: 1em, your right child container will get pushed off to the side, which might not be desirable. Parent container\u2019s CSS #2 &#8211; This will split things 50\/50 and you can add space inbetween WITHOUT [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/seimith.io\/pt\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/\" \/>\n<meta property=\"og:site_name\" content=\"S(ei)mith.io\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-19T21:48:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-20T00:14:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Smith\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smith\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/\"},\"author\":{\"name\":\"Smith\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\"},\"headline\":\"Split sections with CSS Grid with NO floats\",\"datePublished\":\"2020-12-19T21:48:00+00:00\",\"dateModified\":\"2024-07-20T00:14:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/\"},\"wordCount\":84,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"keywords\":[\"Code\"],\"articleSection\":[\"Post\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/\",\"url\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/\",\"name\":\"Split sections with CSS Grid with NO floats - S(ei)mith.io\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"datePublished\":\"2020-12-19T21:48:00+00:00\",\"dateModified\":\"2024-07-20T00:14:49+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#primaryimage\",\"url\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"contentUrl\":\"https:\\\/\\\/seimith.io\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/placeholder_image.webp\",\"width\":700,\"height\":700},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/seimith.io\\\/2020\\\/12\\\/19\\\/split-sections-with-css-grid-with-no-floats\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/seimith.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Split sections with CSS Grid with NO floats\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#website\",\"url\":\"https:\\\/\\\/seimith.io\\\/\",\"name\":\"s(ei)mith.io\",\"description\":\"Ramblings written by\u00a0Smith Suth\u00a0who works at the intersection of Engineering, Product, and Design.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/seimith.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/seimith.io\\\/#\\\/schema\\\/person\\\/315065130ef0017986daf9a1127ce80a\",\"name\":\"Smith\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g\",\"caption\":\"Smith\"},\"sameAs\":[\"https:\\\/\\\/seimith.io\"],\"url\":\"https:\\\/\\\/seimith.io\\\/pt\\\/author\\\/seimithsuth\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Split sections with CSS Grid with NO floats - S(ei)mith.io","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:\/\/seimith.io\/pt\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/","og_locale":"pt_BR","og_type":"article","og_title":"Split sections with CSS Grid with NO floats - S(ei)mith.io","og_description":"Parent container\u2019s CSS #1 &#8211; This will split things 50\/50 However, if you want to add space inbetween these columns with&nbsp;column-gap: 1em, your right child container will get pushed off to the side, which might not be desirable. Parent container\u2019s CSS #2 &#8211; This will split things 50\/50 and you can add space inbetween WITHOUT [&hellip;]","og_url":"https:\/\/seimith.io\/pt\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/","og_site_name":"S(ei)mith.io","article_published_time":"2020-12-19T21:48:00+00:00","article_modified_time":"2024-07-20T00:14:49+00:00","og_image":[{"width":700,"height":700,"url":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","type":"image\/webp"}],"author":"Smith","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smith","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#article","isPartOf":{"@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/"},"author":{"name":"Smith","@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a"},"headline":"Split sections with CSS Grid with NO floats","datePublished":"2020-12-19T21:48:00+00:00","dateModified":"2024-07-20T00:14:49+00:00","mainEntityOfPage":{"@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/"},"wordCount":84,"commentCount":0,"image":{"@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#primaryimage"},"thumbnailUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","keywords":["Code"],"articleSection":["Post"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/","url":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/","name":"Split sections with CSS Grid with NO floats - S(ei)mith.io","isPartOf":{"@id":"https:\/\/seimith.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#primaryimage"},"image":{"@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#primaryimage"},"thumbnailUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","datePublished":"2020-12-19T21:48:00+00:00","dateModified":"2024-07-20T00:14:49+00:00","author":{"@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a"},"breadcrumb":{"@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#primaryimage","url":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","contentUrl":"https:\/\/seimith.io\/wp-content\/uploads\/2020\/12\/placeholder_image.webp","width":700,"height":700},{"@type":"BreadcrumbList","@id":"https:\/\/seimith.io\/2020\/12\/19\/split-sections-with-css-grid-with-no-floats\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/seimith.io\/"},{"@type":"ListItem","position":2,"name":"Split sections with CSS Grid with NO floats"}]},{"@type":"WebSite","@id":"https:\/\/seimith.io\/#website","url":"https:\/\/seimith.io\/","name":"s(ei)mith.io","description":"Ramblings written by\u00a0Smith Suth\u00a0who works at the intersection of Engineering, Product, and Design.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/seimith.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Person","@id":"https:\/\/seimith.io\/#\/schema\/person\/315065130ef0017986daf9a1127ce80a","name":"Smith","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a403a51628e8e4553b69960e9eb8b67184121e56ddf2fdf28c5f9515bb518208?s=96&d=mm&r=g","caption":"Smith"},"sameAs":["https:\/\/seimith.io"],"url":"https:\/\/seimith.io\/pt\/author\/seimithsuth\/"}]}},"_links":{"self":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":1,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":131,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/posts\/130\/revisions\/131"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/media\/288"}],"wp:attachment":[{"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seimith.io\/pt\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}