{"id":111,"date":"2026-04-07T01:36:36","date_gmt":"2026-04-07T01:36:36","guid":{"rendered":"https:\/\/gigz.pk\/css\/?post_type=lesson&#038;p=111"},"modified":"2026-04-07T01:36:37","modified_gmt":"2026-04-07T01:36:37","slug":"flex-container","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/css\/lesson\/flex-container\/","title":{"rendered":"Flex Container"},"content":{"rendered":"\n<p>A Flex Container is the parent element that enables Flexbox layout. When you apply display flex to an element, all its direct children become flex items and follow flexible layout rules.<\/p>\n\n\n\n<p>To create a flex container, you use the display property with the value flex.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>}<\/p>\n\n\n\n<p>Once this is applied, the layout of child elements becomes more dynamic and responsive.<\/p>\n\n\n\n<p>Flex Direction controls the direction in which items are placed inside the container. The default is row, which arranges items horizontally. You can also use column to arrange items vertically.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>flex-direction: column;<br>}<\/p>\n\n\n\n<p>Justify Content is used to align items horizontally along the main axis. It helps control spacing between items.<\/p>\n\n\n\n<p>Common values include flex-start, center, space-between, and space-around.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>justify-content: center;<br>}<\/p>\n\n\n\n<p>Align Items is used to align items vertically along the cross axis.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>align-items: center;<br>}<\/p>\n\n\n\n<p>Flex Wrap allows items to move to the next line if there is not enough space in one row.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>flex-wrap: wrap;<br>}<\/p>\n\n\n\n<p>Align Content is used when there are multiple lines of flex items. It controls spacing between those lines.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>flex-wrap: wrap;<br>align-content: space-between;<br>}<\/p>\n\n\n\n<p>Gap is used to create space between flex items without using margin.<\/p>\n\n\n\n<p>Example<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>gap: 10px;<br>}<\/p>\n\n\n\n<p>A flex container makes it easier to build responsive layouts without using complex positioning. It is widely used in modern web design for creating flexible and adaptive user interfaces.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":0,"template":"","class_list":["post-111","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>Flex Container - 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\/flex-container\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flex Container - CSS learning mastery\" \/>\n<meta property=\"og:description\" content=\"A Flex Container is the parent element that enables Flexbox layout. When you apply display flex to an element, all its direct children become flex items and follow flexible layout rules. To create a flex container, you use the display property with the value flex. Example .container {display: flex;} Once this is applied, the layout [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/css\/lesson\/flex-container\/\" \/>\n<meta property=\"og:site_name\" content=\"CSS learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-07T01:36:37+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\\\/flex-container\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-container\\\/\",\"name\":\"Flex Container - CSS learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\"},\"datePublished\":\"2026-04-07T01:36:36+00:00\",\"dateModified\":\"2026-04-07T01:36:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-container\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-container\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-container\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Flex Container\"}]},{\"@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":"Flex Container - 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\/flex-container\/","og_locale":"en_US","og_type":"article","og_title":"Flex Container - CSS learning mastery","og_description":"A Flex Container is the parent element that enables Flexbox layout. When you apply display flex to an element, all its direct children become flex items and follow flexible layout rules. To create a flex container, you use the display property with the value flex. Example .container {display: flex;} Once this is applied, the layout [&hellip;]","og_url":"https:\/\/gigz.pk\/css\/lesson\/flex-container\/","og_site_name":"CSS learning mastery","article_modified_time":"2026-04-07T01:36:37+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\/flex-container\/","url":"https:\/\/gigz.pk\/css\/lesson\/flex-container\/","name":"Flex Container - CSS learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/css\/#website"},"datePublished":"2026-04-07T01:36:36+00:00","dateModified":"2026-04-07T01:36:37+00:00","breadcrumb":{"@id":"https:\/\/gigz.pk\/css\/lesson\/flex-container\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/css\/lesson\/flex-container\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/css\/lesson\/flex-container\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/css\/"},{"@type":"ListItem","position":2,"name":"Flex Container"}]},{"@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\/111","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=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}