{"id":121,"date":"2026-04-07T04:20:53","date_gmt":"2026-04-07T04:20:53","guid":{"rendered":"https:\/\/gigz.pk\/css\/?post_type=lesson&#038;p=121"},"modified":"2026-04-07T04:20:54","modified_gmt":"2026-04-07T04:20:54","slug":"grid-basics","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/css\/lesson\/grid-basics\/","title":{"rendered":"Grid Basics"},"content":{"rendered":"\n<p>CSS Grid is a powerful layout system used to design web pages in a structured and flexible way. It allows you to create rows and columns easily and place content exactly where you want on the screen.<\/p>\n\n\n\n<p>What is CSS Grid<\/p>\n\n\n\n<p>CSS Grid is a two dimensional layout system. It works with both rows and columns at the same time. This makes it different from Flexbox which works mainly in one direction.<\/p>\n\n\n\n<p>Why use CSS Grid<\/p>\n\n\n\n<p>CSS Grid helps you build complex layouts with less code. It gives better control over spacing alignment and positioning. It is perfect for creating website layouts dashboards and galleries.<\/p>\n\n\n\n<p>Grid Container<\/p>\n\n\n\n<p>To start using CSS Grid you need to define a grid container. This is done by setting the display property to grid.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display grid<br>}<\/p>\n\n\n\n<p>Grid Items<\/p>\n\n\n\n<p>All direct children inside the grid container become grid items. These items can be placed anywhere inside the grid.<\/p>\n\n\n\n<p>Defining Columns<\/p>\n\n\n\n<p>You can define how many columns you want and their sizes using grid template columns.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display grid<br>grid template columns 1fr 1fr 1fr<br>}<\/p>\n\n\n\n<p>This creates three equal columns<\/p>\n\n\n\n<p>Defining Rows<\/p>\n\n\n\n<p>You can also define rows using grid template rows.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display grid<br>grid template rows 100px 200px<br>}<\/p>\n\n\n\n<p>Grid Gap<\/p>\n\n\n\n<p>Grid gap controls the space between rows and columns.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display grid<br>gap 10px<br>}<\/p>\n\n\n\n<p>Placing Items<\/p>\n\n\n\n<p>You can place items in specific positions using grid column and grid row.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.item1 {<br>grid column 1 span 2<br>}<\/p>\n\n\n\n<p>This means the item will take space across two columns<\/p>\n\n\n\n<p>Auto Layout<\/p>\n\n\n\n<p>CSS Grid can automatically adjust layout based on screen size using auto fit or auto fill.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display grid<br>grid template columns repeat auto fit minmax 200px 1fr<br>}<\/p>\n\n\n\n<p>Responsive Design<\/p>\n\n\n\n<p>CSS Grid makes it easy to create responsive layouts without using many media queries. It adjusts content based on available space.<\/p>\n\n\n\n<p>Conclusion<\/p>\n\n\n\n<p>CSS Grid is an essential skill for modern web design. By learning grid basics you can create clean flexible and professional layouts for any website.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":0,"template":"","class_list":["post-121","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Grid Basics - CSS learning mastery<\/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:\/\/gigz.pk\/css\/lesson\/grid-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Grid Basics - CSS learning mastery\" \/>\n<meta property=\"og:description\" content=\"CSS Grid is a powerful layout system used to design web pages in a structured and flexible way. It allows you to create rows and columns easily and place content exactly where you want on the screen. What is CSS Grid CSS Grid is a two dimensional layout system. It works with both rows and [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/css\/lesson\/grid-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"CSS learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-07T04:20:54+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/grid-basics\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/grid-basics\\\/\",\"name\":\"Grid Basics - CSS learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\"},\"datePublished\":\"2026-04-07T04:20:53+00:00\",\"dateModified\":\"2026-04-07T04:20:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/grid-basics\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/grid-basics\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/grid-basics\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Grid Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\",\"name\":\"CSS learning mastery\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/css\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Grid Basics - CSS learning mastery","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:\/\/gigz.pk\/css\/lesson\/grid-basics\/","og_locale":"en_US","og_type":"article","og_title":"Grid Basics - CSS learning mastery","og_description":"CSS Grid is a powerful layout system used to design web pages in a structured and flexible way. It allows you to create rows and columns easily and place content exactly where you want on the screen. What is CSS Grid CSS Grid is a two dimensional layout system. It works with both rows and [&hellip;]","og_url":"https:\/\/gigz.pk\/css\/lesson\/grid-basics\/","og_site_name":"CSS learning mastery","article_modified_time":"2026-04-07T04:20:54+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/gigz.pk\/css\/lesson\/grid-basics\/","url":"https:\/\/gigz.pk\/css\/lesson\/grid-basics\/","name":"Grid Basics - CSS learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/css\/#website"},"datePublished":"2026-04-07T04:20:53+00:00","dateModified":"2026-04-07T04:20:54+00:00","breadcrumb":{"@id":"https:\/\/gigz.pk\/css\/lesson\/grid-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/css\/lesson\/grid-basics\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/css\/lesson\/grid-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/css\/"},{"@type":"ListItem","position":2,"name":"Grid Basics"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/css\/#website","url":"https:\/\/gigz.pk\/css\/","name":"CSS learning mastery","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/css\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/lesson\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/media?parent=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}