{"id":117,"date":"2026-04-07T04:15:21","date_gmt":"2026-04-07T04:15:21","guid":{"rendered":"https:\/\/gigz.pk\/css\/?post_type=lesson&#038;p=117"},"modified":"2026-04-07T04:15:22","modified_gmt":"2026-04-07T04:15:22","slug":"align-items-and-align","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/css\/lesson\/align-items-and-align\/","title":{"rendered":"Align Items and Align"},"content":{"rendered":"\n<p>Align Items and Align Content are important properties used in Flexbox and Grid layouts to control alignment and spacing of elements.<\/p>\n\n\n\n<p>Align Items is used to align items along the cross axis inside a container. In Flexbox, the cross axis is vertical when the flex direction is row. This property affects how individual items are positioned within the container.<\/p>\n\n\n\n<p>Common values of Align Items include stretch which is the default and makes items stretch to fill the container height. Center aligns items in the middle. Flex start aligns items at the top. Flex end aligns items at the bottom. Baseline aligns items based on their text baseline.<\/p>\n\n\n\n<p>Example of Align Items in Flexbox<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>align-items: center;<br>height: 200px;<br>border: 1px solid black;<br>}<\/p>\n\n\n\n<p>This will center all items vertically inside the container.<\/p>\n\n\n\n<p>Align Content is used to control the spacing between rows when there are multiple lines of items. It only works when flex wrap is enabled and there is extra space in the container.<\/p>\n\n\n\n<p>Common values of Align Content include stretch which spreads rows to fill space. Center places rows in the middle. Flex start aligns rows at the top. Flex end aligns rows at the bottom. Space between adds equal space between rows. Space around adds space around rows. Space evenly distributes equal space everywhere.<\/p>\n\n\n\n<p>Example of Align Content in Flexbox<\/p>\n\n\n\n<p>.container {<br>display: flex;<br>flex-wrap: wrap;<br>align-content: space-between;<br>height: 300px;<br>border: 1px solid black;<br>}<\/p>\n\n\n\n<p>This will distribute multiple rows with space between them.<\/p>\n\n\n\n<p>Key Difference between Align Items and Align Content<\/p>\n\n\n\n<p>Align Items controls alignment of individual items inside a single row or column. Align Content controls spacing between multiple rows or lines.<\/p>\n\n\n\n<p>When to use Align Items<\/p>\n\n\n\n<p>Use it when you want to control vertical alignment of items in a single row.<\/p>\n\n\n\n<p>When to use Align Content<\/p>\n\n\n\n<p>Use it when you have multiple rows and want to control spacing between those rows.<\/p>\n\n\n\n<p>Practice Tip<\/p>\n\n\n\n<p>Create a container with multiple items and try different values of align items and align content to clearly understand how they behave.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":0,"template":"","class_list":["post-117","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>Align Items and Align - 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\/align-items-and-align\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Align Items and Align - CSS learning mastery\" \/>\n<meta property=\"og:description\" content=\"Align Items and Align Content are important properties used in Flexbox and Grid layouts to control alignment and spacing of elements. Align Items is used to align items along the cross axis inside a container. In Flexbox, the cross axis is vertical when the flex direction is row. This property affects how individual items are [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/css\/lesson\/align-items-and-align\/\" \/>\n<meta property=\"og:site_name\" content=\"CSS learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-07T04:15:22+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\\\/align-items-and-align\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/align-items-and-align\\\/\",\"name\":\"Align Items and Align - CSS learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\"},\"datePublished\":\"2026-04-07T04:15:21+00:00\",\"dateModified\":\"2026-04-07T04:15:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/align-items-and-align\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/align-items-and-align\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/align-items-and-align\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Align Items and Align\"}]},{\"@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":"Align Items and Align - 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\/align-items-and-align\/","og_locale":"en_US","og_type":"article","og_title":"Align Items and Align - CSS learning mastery","og_description":"Align Items and Align Content are important properties used in Flexbox and Grid layouts to control alignment and spacing of elements. Align Items is used to align items along the cross axis inside a container. In Flexbox, the cross axis is vertical when the flex direction is row. This property affects how individual items are [&hellip;]","og_url":"https:\/\/gigz.pk\/css\/lesson\/align-items-and-align\/","og_site_name":"CSS learning mastery","article_modified_time":"2026-04-07T04:15:22+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\/align-items-and-align\/","url":"https:\/\/gigz.pk\/css\/lesson\/align-items-and-align\/","name":"Align Items and Align - CSS learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/css\/#website"},"datePublished":"2026-04-07T04:15:21+00:00","dateModified":"2026-04-07T04:15:22+00:00","breadcrumb":{"@id":"https:\/\/gigz.pk\/css\/lesson\/align-items-and-align\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/css\/lesson\/align-items-and-align\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/css\/lesson\/align-items-and-align\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/css\/"},{"@type":"ListItem","position":2,"name":"Align Items and Align"}]},{"@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\/117","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=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}