{"id":115,"date":"2026-04-07T01:38:39","date_gmt":"2026-04-07T01:38:39","guid":{"rendered":"https:\/\/gigz.pk\/css\/?post_type=lesson&#038;p=115"},"modified":"2026-04-07T01:38:40","modified_gmt":"2026-04-07T01:38:40","slug":"justify-content","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/css\/lesson\/justify-content\/","title":{"rendered":"Justify Content"},"content":{"rendered":"\n<p>Justify Content is a CSS property used in Flexbox to align items horizontally inside a container. It controls how space is distributed between and around items along the main axis.<\/p>\n\n\n\n<p>To use justify content, the container must have display set to flex.<\/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>This will place all items in the center horizontally.<\/p>\n\n\n\n<p>Common Values of Justify Content<\/p>\n\n\n\n<p>Flex start<br>Items align to the left side of the container.<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>justify-content: flex-start;<br>}<\/p>\n\n\n\n<p>Flex end<br>Items align to the right side of the container.<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>justify-content: flex-end;<br>}<\/p>\n\n\n\n<p>Center<br>Items move to the center of the container.<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>justify-content: center;<br>}<\/p>\n\n\n\n<p>Space between<br>Items spread out with equal space between them. No space on edges.<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>justify-content: space-between;<br>}<\/p>\n\n\n\n<p>Space around<br>Items have equal space around them. Space on edges is smaller.<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>justify-content: space-around;<br>}<\/p>\n\n\n\n<p>Space evenly<br>Items are spaced evenly with equal space on both sides.<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>justify-content: space-evenly;<br>}<\/p>\n\n\n\n<p>Important Notes<\/p>\n\n\n\n<p>Justify content works only with flex or grid containers.<br>It controls horizontal alignment when flex direction is row.<br>For vertical alignment, use align items.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":0,"template":"","class_list":["post-115","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>Justify Content - 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\/justify-content\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Justify Content - CSS learning mastery\" \/>\n<meta property=\"og:description\" content=\"Justify Content is a CSS property used in Flexbox to align items horizontally inside a container. It controls how space is distributed between and around items along the main axis. To use justify content, the container must have display set to flex. Example .container {display: flex;justify-content: center;} This will place all items in the center [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/css\/lesson\/justify-content\/\" \/>\n<meta property=\"og:site_name\" content=\"CSS learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-07T01:38:40+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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/justify-content\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/justify-content\\\/\",\"name\":\"Justify Content - CSS learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\"},\"datePublished\":\"2026-04-07T01:38:39+00:00\",\"dateModified\":\"2026-04-07T01:38:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/justify-content\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/justify-content\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/justify-content\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Justify Content\"}]},{\"@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":"Justify Content - 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\/justify-content\/","og_locale":"en_US","og_type":"article","og_title":"Justify Content - CSS learning mastery","og_description":"Justify Content is a CSS property used in Flexbox to align items horizontally inside a container. It controls how space is distributed between and around items along the main axis. To use justify content, the container must have display set to flex. Example .container {display: flex;justify-content: center;} This will place all items in the center [&hellip;]","og_url":"https:\/\/gigz.pk\/css\/lesson\/justify-content\/","og_site_name":"CSS learning mastery","article_modified_time":"2026-04-07T01:38:40+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/gigz.pk\/css\/lesson\/justify-content\/","url":"https:\/\/gigz.pk\/css\/lesson\/justify-content\/","name":"Justify Content - CSS learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/css\/#website"},"datePublished":"2026-04-07T01:38:39+00:00","dateModified":"2026-04-07T01:38:40+00:00","breadcrumb":{"@id":"https:\/\/gigz.pk\/css\/lesson\/justify-content\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/css\/lesson\/justify-content\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/css\/lesson\/justify-content\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/css\/"},{"@type":"ListItem","position":2,"name":"Justify Content"}]},{"@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\/115","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=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}