{"id":33932,"date":"2017-07-07T15:01:12","date_gmt":"2017-07-07T07:01:12","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=33932"},"modified":"2018-04-09T16:50:56","modified_gmt":"2018-04-09T08:50:56","slug":"moving-css-grid-items","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/","title":{"rendered":"Moving Items in CSS Grid Layout [Guide]"},"content":{"rendered":"<p>Using the <strong>CSS Grid Layout Module<\/strong> in web design becomes more and more feasible as more browsers begin to <strong><a href=\"https:\/\/caniuse.com\/#search=css%20grid\" target=\"_blank\" rel=\"nofollow\">support it<\/a><\/strong>. While creating layouts filling in grid cells, there might come a moment, though, when you want to achieve more complicated things.<\/p>\n<p>For instance, you might want to <strong>slightly move around<\/strong> some of the grid items stuck in their grid areas. You also might want to <strong>move them out of the grid container<\/strong> (overflow), or <strong>over each other<\/strong> (overlap), or just\u2026 to some empty space around.<\/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\/css-grid-layout-module\/\">Introduction to the CSS Grid Layout Module<\/a>\n\t\t\t\t<\/p>\n<p>So, in this post, I\u2019ll show you how you can <strong>move, order, overflow, overlap, and size grid items<\/strong> when you use the <a href=\"https:\/\/www.w3.org\/TR\/css-grid-1\/\" target=\"_blank\" rel=\"nofollow\">CSS Grid Layout Module<\/a>.<\/p>\n<h2>Create a CSS grid<\/h2>\n<p>First, let\u2019s create a simple CSS grid with <strong> one row and three columns<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-without-overflow.jpg\" alt=\"Grid items without overflow\" width=\"1000\" height=\"484\"><\/figure>\n<p>In the HTML, we create a bunch of divs where the grid container <strong>contains the three grid items<\/strong>.<\/p>\n<pre>\r\n&lt;div class='grid-container'&gt;\r\n  &lt;div class='grid-left'&gt;&lt;\/div&gt;\r\n  &lt;div class='grid-center'&gt;&lt;\/div&gt;\r\n  &lt;div class='grid-right'&gt;&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>In the CSS, the grid container <strong>has the <code>display: grid;<\/code> property<\/strong> and the grid items <strong>have <a target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-area\"><code>grid-area<\/code><\/a><\/strong> that identifies the names of the grid item areas.<\/p>\n<p>We also <strong>add the <a target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-template-areas\"><code>grid-template-areas<\/code><\/a> property<\/strong> to the grid container, in which the grid area names are used to <strong>assign the grid areas to the grid cells they represent<\/strong>.<\/p>\n<p>All columns <strong>take the size of <a href=\"https:\/\/www.hongkiat.com\/blog\/css-grid-layout-fr-unit\/\">one fraction<\/a> (<code>fr<\/code>)<\/strong> of the container width, ensuring the containment of the grid items.<\/p>\n<pre>\r\n.grid-container {\r\n  display: grid;\r\n  grid-template-areas: 'left center right';\r\n  grid-template-columns: repeat(3, 1fr);\r\n  grid-template-rows: 80px;\r\n  grid-gap: 5px;\r\n  width: 360px;\r\n  background-color: magenta;\r\n}\r\n.grid-left {\r\n  grid-area: left;\r\n}\r\n.grid-center {\r\n  grid-area: center;\r\n}\r\n.grid-right {\r\n  grid-area: right;\r\n}\r\n.grid-container div {\r\n  background-color: lightgreen;\r\n}\r\n<\/pre>\n<h2>Overflow grid items<\/h2>\n<p>You can make a grid item <strong>overflow its grid container<\/strong> if it\u2019s necessary for a layout. To achieve the overflow effect, you just need to <strong>use a different column size<\/strong>:<\/p>\n<pre>\r\n.grid-container {\r\n  display: grid;\r\n  grid-template-areas: 'left center right';\r\n  grid-template-columns: repeat(3, 150px);\r\n  grid-gap: 5px;\r\n}\r\n<\/pre>\n<p>The <strong>sum of the column- and gap-size<\/strong> is bigger than the <strong>width of the container<\/strong>, which causes the grid items overflow their container.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-items-overflown.jpg\" alt=\"Grid items with overflow effect\" width=\"1000\" height=\"485\"><\/figure>\n<h2>Overlap grid items<\/h2>\n<p>A <strong>grid item can overlap<\/strong> (fully or partially cover) <strong>another grid item<\/strong> in the following cases:<\/p>\n<ol>\n<li>It\u2019s set to span across (and over) the cell(s) of another grid item.<\/li>\n<li>Its size has been increased, causing it to overlap with the nearby grid item.<\/li>\n<li>It\u2019s moved over on top of another grid item.<\/li>\n<\/ol>\n<p>We\u2019ll discuss the second and third cases later, in the \u201cSizing\u201d and \u201cMoving\u201d sections.<\/p>\n<p>First, let\u2019s see the first case when a grid item <strong>spans across another one<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-items-overlapped.jpg\" alt=\"CSS grid items overlapped\" width=\"1000\" height=\"467\"><\/figure>\n<p>The grid item at the center has <strong>spanned over the left one<\/strong>, so only two items are visible on the screen.<\/p>\n<pre>\r\n.grid-center {\r\n  grid-area: center;\r\n  grid-column: 1 \/ 3;\r\n}\r\n<\/pre>\n<p>The <a target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-column\"><code>grid-column<\/code><\/a> and <a target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/grid-row\"><code>grid-row<\/code><\/a> properties <strong>assign grid lines<\/strong> between which a column or row needs to fit.<\/p>\n<p>On the below diagram, you can see how the <code>grid-column: 1 \/ 3<\/code> CSS rule works: the center column <strong>spans between the grid lines 1 and 3<\/strong>. As a result, the center column overlaps the left one.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-lines.jpg\" alt=\"Grid lines\" width=\"1000\" height=\"706\"><\/figure>\n<h2>Move grid items<\/h2>\n<p>By moving, I mean <strong>moving the items slightly around<\/strong>. If you completely want to relocate an item into another grid cell\/area I recommend you update the grid creation code.<\/p>\n<p>Moving around grid items is simple. Just <strong>use the <code>margin<\/code>, the <code>transform<\/code>, or the <code>position:relative;<\/code> properties<\/strong>. See below how the items are moved using those properties.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-items-moved.jpg\" alt=\"Grid item moved\" width=\"1000\" height=\"421\"><\/figure>\n<p>The center and right grid items can be moved (as shown above) in the following ways:<\/p>\n<h3>1. Using <code>margin<\/code><\/h3>\n<p>Negative margins increase the dimensions of grid items, while positive margins trim them. By using a combination of both, you can slighlty move the grid items around.<\/p>\n<pre>\r\n.grid-center {\r\n  grid-area: center;\r\n  margin-left: -10px;\r\n  margin-right: 10px;\r\n  margin-top: -10px;\r\n  margin-bottom: 10px;\r\n}\r\n.grid-right {\r\n  grid-area: right;\r\n  margin-left: 10px;\r\n  margin-right: -10px;\r\n  margin-top: -10px;\r\n  margin-bottom: 10px;\r\n}\r\n<\/pre>\n<h3>2. Using <code>transform<\/code><\/h3>\n<p>The <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/transform-function\/translate\" target=\"_blank\"><code>translate()<\/code><\/a> CSS function <strong>moves an element along the x- and y-axes<\/strong>. Using it together with the <code>transform<\/code> property allows you to change the position of a grid item.<\/p>\n<pre>\r\n.grid-center {\r\n  grid-area: center;\r\n  transform: translate(-10px, -10px);\r\n}\r\n.grid-right {\r\n  grid-area: right;\r\n  transform: translate(10px, -10px);\r\n}\r\n<\/pre>\n<h3>3. Using <code>position<\/code><\/h3>\n<p>Using the <code>position: relative;<\/code> rule with the specified <code>top<\/code>, <code>bottom<\/code>, <code>left<\/code>, and <code>right<\/code> properties can be used for moving around grid items as well.<\/p>\n<pre>\r\n.grid-center {\r\n  grid-area:  center;\r\n  position: relative;\r\n  bottom: 10px;\r\n  right: 10px;\r\n}\r\n.grid-right {\r\n  grid-area: right;\r\n  position: relative;\r\n  bottom: 10px;\r\n  left: 10px;\r\n}\r\n<\/pre>\n<h2>Order grid items<\/h2>\n<p>Grid items are rendered on the screen <strong>in the order they appear in the HTML source code<\/strong>.<\/p>\n<p>In the previous section, when the center item was moved left, it was placed on top of the left item by the browser. This happened because in the HTML, <code>&lt;div class='grid-center'&gt;<\/code> comes after <code>&lt;div class='grid-left'&gt;<\/code>, hence the center item is <strong>rendered after (and over)<\/strong> the left one.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-items-moved.jpg\" alt=\"Grid item moved\" width=\"1000\" height=\"421\"><\/figure>\n<p>However, we can <strong>change the order grid items<\/strong> using the <a target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/z-index\"><code>z-index<\/code><\/a> or the <a target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/order\"><code>order<\/code><\/a> CSS properties.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-items-order.jpg\" alt=\"Grid item order changed\" width=\"1000\" height=\"447\"><\/figure>\n<p>Using the <code>z-index: 1;<\/code> rule, the left grid item <strong>got a higher stacking context<\/strong>.<\/p>\n<pre>.\r\ngrid-left{\r\n  grid-area: left;\r\n  z-index: 1;\r\n}\r\n<\/pre>\n<p>As in the CSS Grid Layout module, changing the element order in HTML <strong>doesn\u2019t affect the grid layout<\/strong>, you can also put <code>&lt;div class='grid-center'&gt;<\/code> before <code>&lt;div class='grid-left'&gt;<\/code> in the HTML. Only do this, though, if the updated HTML code doesn\u2019t harm accessibility.<\/p>\n<h2>Size grid items<\/h2>\n<p>If you use auto-sized rows or columns for a grid item (using <code>auto<\/code>, <code>fr<\/code>, <code>gr<\/code> units), it will shrink to make space for its neighbouring item that has grown in size <em>only if<\/em> said item <strong>was not sized by <code>transform<\/code> or a negative margin<\/strong>.<\/p>\n<p>Remember, in our sample grid, all three columns take one fraction (<code>fr<\/code>) of the grid container. Take a look at how all three items look like after the left one is resized in two different ways.<\/p>\n<h3>1. Sized with <code>width<\/code> and <code>height<\/code><\/h3>\n<p>Here, we change the size of the left item <strong>using the <code>width<\/code> and <code>height<\/code> properties<\/strong>. As a result, it stays inside the grid container.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-items-sized-dimension.jpg\" alt=\"Grid item sized with dimensions\" width=\"1000\" height=\"380\"><\/figure>\n<pre>\r\n.grid-left {\r\n  grid-area: left;\r\n  width: 200px;\r\n  height: 90px;\r\n}\r\n<\/pre>\n<h3>2. Sized with <code>transform<\/code><\/h3>\n<p>Here, we change the size of the left item <strong>using the <code>transform<\/code> property<\/strong>. As a result, it overflows the container and the grid gap also disappears.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-items-sized-transform.jpg\" alt=\"Grid item sized with transform\" width=\"1000\" height=\"330\"><\/figure>\n<pre>\r\n.grid-left {\r\n  grid-area: left;\r\n  transform: scalex(1.8);\r\n}\r\n<\/pre>\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\/css-grid-wordpress\/\">How to Integrate Simple CSS Grid Layouts into WordPress<\/a>\n\t\t\t\t<\/p>","protected":false},"excerpt":{"rendered":"<p>Using the CSS Grid Layout Module in web design becomes more and more feasible as more browsers begin to support it. While creating layouts filling in grid cells, there might come a moment, though, when you want to achieve more complicated things. For instance, you might want to slightly move around some of the grid&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.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Moving Items in CSS Grid Layout [Guide] - Hongkiat<\/title>\n<meta name=\"description\" content=\"Using the CSS Grid Layout Module in web design becomes more and more feasible as more browsers begin to support it. While creating layouts filling in grid\" \/>\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\/moving-css-grid-items\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moving Items in CSS Grid Layout [Guide]\" \/>\n<meta property=\"og:description\" content=\"Using the CSS Grid Layout Module in web design becomes more and more feasible as more browsers begin to support it. While creating layouts filling in grid\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/\" \/>\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-07-07T07:01:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-04-09T08:50:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-without-overflow.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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/\"},\"author\":{\"name\":\"Preethi Ranjit\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\"},\"headline\":\"Moving Items in CSS Grid Layout [Guide]\",\"datePublished\":\"2017-07-07T07:01:12+00:00\",\"dateModified\":\"2018-04-09T08:50:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/\"},\"wordCount\":842,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/moving-css-grid-items\\\/grid-without-overflow.jpg\",\"keywords\":[\"CSS\",\"CSS Grid Layout\",\"CSS Tutorials\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/\",\"name\":\"Moving Items in CSS Grid Layout [Guide] - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/moving-css-grid-items\\\/grid-without-overflow.jpg\",\"datePublished\":\"2017-07-07T07:01:12+00:00\",\"dateModified\":\"2018-04-09T08:50:56+00:00\",\"description\":\"Using the CSS Grid Layout Module in web design becomes more and more feasible as more browsers begin to support it. While creating layouts filling in grid\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/moving-css-grid-items\\\/grid-without-overflow.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/moving-css-grid-items\\\/grid-without-overflow.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/moving-css-grid-items\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moving Items in CSS Grid Layout [Guide]\"}]},{\"@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":"Moving Items in CSS Grid Layout [Guide] - Hongkiat","description":"Using the CSS Grid Layout Module in web design becomes more and more feasible as more browsers begin to support it. While creating layouts filling in grid","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\/moving-css-grid-items\/","og_locale":"en_US","og_type":"article","og_title":"Moving Items in CSS Grid Layout [Guide]","og_description":"Using the CSS Grid Layout Module in web design becomes more and more feasible as more browsers begin to support it. While creating layouts filling in grid","og_url":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2017-07-07T07:01:12+00:00","article_modified_time":"2018-04-09T08:50:56+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-without-overflow.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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/"},"author":{"name":"Preethi Ranjit","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3"},"headline":"Moving Items in CSS Grid Layout [Guide]","datePublished":"2017-07-07T07:01:12+00:00","dateModified":"2018-04-09T08:50:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/"},"wordCount":842,"commentCount":0,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-without-overflow.jpg","keywords":["CSS","CSS Grid Layout","CSS Tutorials"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/","url":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/","name":"Moving Items in CSS Grid Layout [Guide] - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-without-overflow.jpg","datePublished":"2017-07-07T07:01:12+00:00","dateModified":"2018-04-09T08:50:56+00:00","description":"Using the CSS Grid Layout Module in web design becomes more and more feasible as more browsers begin to support it. While creating layouts filling in grid","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-without-overflow.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/moving-css-grid-items\/grid-without-overflow.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/moving-css-grid-items\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Moving Items in CSS Grid Layout [Guide]"}]},{"@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-8Pi","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/33932","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=33932"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/33932\/revisions"}],"predecessor-version":[{"id":42158,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/33932\/revisions\/42158"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=33932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=33932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=33932"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=33932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}