{"id":113,"date":"2026-04-07T01:37:28","date_gmt":"2026-04-07T01:37:28","guid":{"rendered":"https:\/\/gigz.pk\/css\/?post_type=lesson&#038;p=113"},"modified":"2026-04-07T01:37:29","modified_gmt":"2026-04-07T01:37:29","slug":"flex-direction-and-flex-wrap","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/css\/lesson\/flex-direction-and-flex-wrap\/","title":{"rendered":"Flex Direction and Flex Wrap"},"content":{"rendered":"\n<p>Flexbox is a layout system in CSS that helps arrange items inside a container. Two important properties in Flexbox are flex direction and flex wrap. These properties control how items are placed and how they behave when there is not enough space.<\/p>\n\n\n\n<p>Flex direction defines the direction in which items are arranged inside a flex container. By default, items are placed in a row from left to right. This means all elements appear in a horizontal line.<\/p>\n\n\n\n<p>There are four main values of flex direction. Row places items horizontally from left to right. Row reverse places items horizontally from right to left. Column arranges items vertically from top to bottom. Column reverse arranges items vertically from bottom to top.<\/p>\n\n\n\n<p>Example of flex direction in CSS:<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>flex-direction: row;<br>}<\/p>\n\n\n\n<p>Flex wrap controls whether items should stay in one line or move to the next line when space is limited. By default, all items try to fit into one line, even if they overflow.<\/p>\n\n\n\n<p>There are three main values of flex wrap. Nowrap keeps all items in a single line and may cause overflow. Wrap allows items to move to the next line when needed. Wrap reverse also allows wrapping but in reverse order.<\/p>\n\n\n\n<p>Example of flex wrap in CSS:<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>flex-wrap: wrap;<br>}<\/p>\n\n\n\n<p>When flex direction and flex wrap are used together, they give better control over layout behavior. For example, using row with wrap allows items to move into multiple lines while staying horizontal.<\/p>\n\n\n\n<p>Example combining both properties:<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>flex-direction: row;<br>flex-wrap: wrap;<br>}<\/p>\n\n\n\n<p>These properties are very useful for building responsive layouts. They help content adjust automatically to different screen sizes without breaking the design.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":0,"template":"","class_list":["post-113","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 Direction and Flex Wrap - 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-direction-and-flex-wrap\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flex Direction and Flex Wrap - CSS learning mastery\" \/>\n<meta property=\"og:description\" content=\"Flexbox is a layout system in CSS that helps arrange items inside a container. Two important properties in Flexbox are flex direction and flex wrap. These properties control how items are placed and how they behave when there is not enough space. Flex direction defines the direction in which items are arranged inside a flex [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/css\/lesson\/flex-direction-and-flex-wrap\/\" \/>\n<meta property=\"og:site_name\" content=\"CSS learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-07T01:37:29+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-direction-and-flex-wrap\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-direction-and-flex-wrap\\\/\",\"name\":\"Flex Direction and Flex Wrap - CSS learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\"},\"datePublished\":\"2026-04-07T01:37:28+00:00\",\"dateModified\":\"2026-04-07T01:37:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-direction-and-flex-wrap\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-direction-and-flex-wrap\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/flex-direction-and-flex-wrap\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Flex Direction and Flex Wrap\"}]},{\"@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 Direction and Flex Wrap - 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-direction-and-flex-wrap\/","og_locale":"en_US","og_type":"article","og_title":"Flex Direction and Flex Wrap - CSS learning mastery","og_description":"Flexbox is a layout system in CSS that helps arrange items inside a container. Two important properties in Flexbox are flex direction and flex wrap. These properties control how items are placed and how they behave when there is not enough space. Flex direction defines the direction in which items are arranged inside a flex [&hellip;]","og_url":"https:\/\/gigz.pk\/css\/lesson\/flex-direction-and-flex-wrap\/","og_site_name":"CSS learning mastery","article_modified_time":"2026-04-07T01:37:29+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-direction-and-flex-wrap\/","url":"https:\/\/gigz.pk\/css\/lesson\/flex-direction-and-flex-wrap\/","name":"Flex Direction and Flex Wrap - CSS learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/css\/#website"},"datePublished":"2026-04-07T01:37:28+00:00","dateModified":"2026-04-07T01:37:29+00:00","breadcrumb":{"@id":"https:\/\/gigz.pk\/css\/lesson\/flex-direction-and-flex-wrap\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/css\/lesson\/flex-direction-and-flex-wrap\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/css\/lesson\/flex-direction-and-flex-wrap\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/css\/"},{"@type":"ListItem","position":2,"name":"Flex Direction and Flex Wrap"}]},{"@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\/113","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=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}