{"id":58053,"date":"2023-08-21T09:26:19","date_gmt":"2023-08-21T03:56:19","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=58053"},"modified":"2023-08-29T09:31:33","modified_gmt":"2023-08-29T04:01:33","slug":"exploring-flex-box-property-in-css","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/exploring-flex-box-property-in-css\/","title":{"rendered":"EXPLORING FLEX BOX PROPERTY IN CSS"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Flex is the value of the css display property. By using a flex in the parent, the child elements are automatically shaped like a line or column with their respective initial width and height.<\/span><\/p>\n<h2><b>Properties of Flex Container<\/b><b><\/b><\/h2>\n<h3><b>1.Display Flex:<\/b><\/h3>\n<p><span style=\"font-weight: 400;\"> CSS Display property can have value flex or inline-flex. By using display flex or inline-flex to parent container, the children automatically enable flex content.<\/span><br \/>\n<strong>Display Box:<\/strong><\/p>\n<pre><span style=\"font-weight: 400;\">.container {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0display: block;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58029\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/1-1-243x300.png\" alt=\"\" width=\"243\" height=\"300\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/1-1-243x300.png 243w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/1-1.png 288w\" sizes=\"(max-width: 243px) 100vw, 243px\" \/><\/p>\n<p><strong><i>Display Flex:<\/i><\/strong><\/p>\n<pre><span style=\"font-weight: 400;\">.container {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0display: flex; \/* or inline-flex *\/<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58030\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png\" alt=\"\" width=\"300\" height=\"78\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1.png 457w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><br \/>\n<b><\/b><\/p>\n<h3><b>2. Flex Direction:<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The Flex Direction property is used to change the direction of flex items. By default, the flex-direction is row.\u00a0 Flex box is a one-way layout concept. Items are usually arranged in horizontal or vertical rows.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Flex Directions values are as follows:<\/span><\/p>\n<ul>\n<li><b>row ( default):<\/b><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58030\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png\" alt=\"\" width=\"300\" height=\"78\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1.png 457w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>row-reverse:<\/b><\/li>\n<\/ul>\n<p><b><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58031\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/3-1-300x65.png\" alt=\"\" width=\"300\" height=\"65\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/3-1-300x65.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/3-1.png 509w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/b><br \/>\n<b><\/b><\/p>\n<ul>\n<li><b>column:<\/b><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58029\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/1-1-243x300.png\" alt=\"\" width=\"243\" height=\"300\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/1-1-243x300.png 243w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/1-1.png 288w\" sizes=\"(max-width: 243px) 100vw, 243px\" \/><\/p>\n<ul>\n<li><b>column-reverse:<\/b><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58032\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/4-1-141x300.png\" alt=\"\" width=\"141\" height=\"300\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/4-1-141x300.png 141w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/4-1.png 189w\" sizes=\"(max-width: 141px) 100vw, 141px\" \/><\/p>\n<h3><b>3. Flex wrap:<\/b><\/h3>\n<p>In this, flex items try to fit on one line.<\/p>\n<p><span style=\"font-weight: 400;\">Flex wrap values are as follows:<\/span><\/p>\n<ul>\n<li><b>nowrap ( default):<\/b><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58030\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png\" alt=\"\" width=\"300\" height=\"78\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1.png 457w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>wrap ( wrap to next line):<\/b><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58033\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/5-1-300x191.png\" alt=\"\" width=\"300\" height=\"191\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/5-1-300x192.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/5-1.png 302w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>wrap-reverse ( multiple lines but in reverse from bottom to top ):<\/b><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-58034\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/6-1.png\" alt=\"\" width=\"296\" height=\"194\" \/><\/p>\n<h3><b>4. Justify Content:<\/b><\/h3>\n<p>This defines the relationship along the major axis. It helps to allocate additional free space when all the flex items in the row are fixed or adjustable but have reached their maximum size.<\/p>\n<p><span style=\"font-weight: 400;\">Justify Content values are as follows:<\/span><\/p>\n<ul>\n<li><b>flex-start (default) \/ start:<\/b><span style=\"font-weight: 400;\"> Items are packed toward the start of the flex-direction.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58030\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png\" alt=\"\" width=\"300\" height=\"78\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1-300x78.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/2-1.png 457w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>Flex-end \/ end:<\/b><span style=\"font-weight: 400;\"> Items are packed toward the end of the flex-direction.<\/span><\/li>\n<\/ul>\n<p><b><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58035\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/7-300x61.png\" alt=\"\" width=\"300\" height=\"61\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/7-300x61.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/7.png 577w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/b><br \/>\n<b><\/b><\/p>\n<ul>\n<li><b>center:<\/b><span style=\"font-weight: 400;\"> Items are centered along the line.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58036\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/8-300x49.png\" alt=\"\" width=\"300\" height=\"49\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/8-300x49.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/8-624x101.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/8.png 677w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>space-between:<\/b><span style=\"font-weight: 400;\"> Items are evenly distributed in the line; the first item is on the start line, and the last item is on the end line.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58037\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/9-300x62.png\" alt=\"\" width=\"300\" height=\"62\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/9-300x62.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/9.png 597w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>space-around:<\/b><span style=\"font-weight: 400;\"> Items are evenly spaced in rows with equal space around them. Remember that space is not equal because all objects have equal dimensions.\u00a0<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58038\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/10-300x60.png\" alt=\"\" width=\"300\" height=\"60\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/10-300x60.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/10.png 594w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>space-evenly:<\/b><span style=\"font-weight: 400;\"> Items are distributed so that the spacing between any two items (and the space to the edges) is equal.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58039\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/11-300x59.png\" alt=\"\" width=\"300\" height=\"59\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/11-300x59.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/11.png 596w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">You can combine these results with two additional keywords: secure and unsafe.\u00a0<\/span><\/p>\n<h3><b>5. Align Items: <\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This defines the default behavior for how flex items are laid out along the cross-axis on the current line.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Align item values are as follows:<\/span><\/p>\n<ul>\n<li><b>stretch (default): <\/b><span style=\"font-weight: 400;\">Stretch to fill the container (still respect min-width\/max-width).<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58040\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/12-300x115.png\" alt=\"\" width=\"300\" height=\"115\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/12-300x115.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/12.png 476w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>flex-start \/ start \/ self-start:<\/b><span style=\"font-weight: 400;\"> Items are placed at the start of the cross-axis. The difference between these is subtle and is about respecting the flex-direction rules or the writing-mode rules.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58040\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/12-300x115.png\" alt=\"\" width=\"300\" height=\"115\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/12-300x115.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/12.png 476w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>flex-end \/ end \/ self-end: <\/b><span style=\"font-weight: 400;\">Items are placed at the end of the cross-axis. The difference, again is subtle and is about respecting flex-direction rules vs. writing-mode rules.<\/span><\/li>\n<\/ul>\n<p><b><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58041\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/13-300x109.png\" alt=\"\" width=\"300\" height=\"109\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/13-300x109.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/13.png 503w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/b><br \/>\n<b><\/b><\/p>\n<ul>\n<li><b>center:<\/b><span style=\"font-weight: 400;\"> items are centered in the cross-axis.<\/span><\/li>\n<\/ul>\n<p><b><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58042\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/14-300x111.png\" alt=\"\" width=\"300\" height=\"111\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/14-300x111.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/14.png 497w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/b><br \/>\n<b><\/b><\/p>\n<ul>\n<li><b>baseline: <\/b><span style=\"font-weight: 400;\">Items are aligned such as their baselines align.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58040\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/12-300x115.png\" alt=\"\" width=\"300\" height=\"115\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/12-300x115.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/12.png 476w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h2><b>Properties of flex items ( child of container)<\/b><\/h2>\n<h3><b>1. Order:<\/b><\/h3>\n<h4><span style=\"font-weight: 400;\">The order property of flex items sets the order in which they appear in the parent container. The default order is 0. The value of order is always a number. order can be positive or negative.<\/span><\/h4>\n<pre><span style=\"font-weight: 400;\">.item {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0order: 5; \/* default is 0 *\/<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58044\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/16-300x69.png\" alt=\"\" width=\"300\" height=\"69\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/16-300x69.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/16.png 494w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58045\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/17-300x76.png\" alt=\"\" width=\"300\" height=\"76\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/17-300x76.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/17.png 431w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><b>2. Flex grow: <\/b><\/h3>\n<h4><span style=\"font-weight: 400;\">This defines the elastic material&#8217;s ability to grow when needed. It accepts worthlessness as a measure. Determines the area in the flexbox.<\/span><\/h4>\n<p><b>Negative numbers are invalid.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Flex grow values are as follows:<\/span><\/p>\n<ul>\n<li><b>0:<\/b><span style=\"font-weight: 400;\"> This is the default value of flex-grow.<\/span><\/li>\n<\/ul>\n<p><b><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58045\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/17-300x76.png\" alt=\"\" width=\"300\" height=\"76\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/17-300x76.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/17.png 431w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/b><br \/>\n<b><\/b><\/p>\n<ul>\n<li><b>Number:<\/b><span style=\"font-weight: 400;\"> Number means the width of the flex item will be distributed equally to all items.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58046\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/18-300x54.png\" alt=\"\" width=\"300\" height=\"54\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/18-300x54.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/18.png 591w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><b>3. Flex Shrink:<\/b><\/h3>\n<p>This defines the ability for a flex item to shrink if necessary. 1 is the default value of flex-shrink. The value can be any positive value or 0. Flex-shrink 0 means the flex item will not shrink.<\/p>\n<p><span style=\"font-weight: 400;\">Flex shrink values are as follows:<\/span><\/p>\n<ul>\n<li><b>1 (default):<\/b><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58047\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/19-300x55.png\" alt=\"\" width=\"300\" height=\"55\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/19-300x55.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/19.png 590w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ul>\n<li><b>0<\/b><span style=\"font-weight: 400;\">: In the below example, we can see that the middle element got shrunk. Rest all remains the same.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58048\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/20px-300x59.png\" alt=\"\" width=\"300\" height=\"59\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/20px-300x59.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/20px.png 596w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><strong>4. Flex Basis:<\/strong><\/h3>\n<p>This property of flex items defines the initial main size ( width or height ) of flex items. The flex-basis value could be auto, %, px, em, or rem. The default value of flex-basis is 0.<\/p>\n<ul>\n<li><b>flex-basis: <\/b><span style=\"font-weight: 400;\">auto will apply automatic or equal width to flex items. If flex items are two, then it&#8217;s 50%, if flex items are 3, then 33.33%; and if it&#8217;s 4, then 25% each.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58049\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/21-300x57.png\" alt=\"\" width=\"300\" height=\"57\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/21-300x57.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/21.png 593w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h4><b>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/b><b><\/b><\/h4>\n<h3>5. Flex:<\/h3>\n<h4><span style=\"font-weight: 400;\">Flex is the shorthand for flex-grow, flex-shrink, and flex-basis. We use <\/span><span style=\"font-weight: 400;\">0 1 0% as the\u00a0<\/span><span style=\"font-weight: 400;\">default value of flex.\u00a0<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">Always prefer flex shorthand property for flex-grow, flex-shrink, and flex-basis for simplicity.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">.item {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0flex: none | [ &lt;'flex-grow'&gt; &lt;'flex-shrink'&gt;? || &lt;'flex-basis'&gt; ]<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h3><strong>6. Align self:<\/strong><\/h3>\n<p>This allows the default alignment (or the one specified by align-items) to be overridden for individual flex items.<\/p>\n<p><span style=\"font-weight: 400;\">Align self values are as follows:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">auto<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">flex-start<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">center<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">flex-end<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">baseline<\/span><\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58050\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/22-300x98.png\" alt=\"\" width=\"300\" height=\"98\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/22-300x98.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/22.png 412w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58051\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/23-300x263.png\" alt=\"\" width=\"300\" height=\"263\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/23-300x263.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/23.png 435w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-58052\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/24-300x147.png\" alt=\"\" width=\"300\" height=\"147\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/24-300x147.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/24.png 593w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h4>Conclusion:<\/h4>\n<p><span style=\"font-weight: 400;\">Flexbox is a CSS display-type design. It helps us to craft CSS layouts quite easily. It has a great responsive design. It controls the position, spacing, and size of elements with respect to their parents. It has bundles of properties that define formatting context to control layout.<br \/>\nPlease refer to our blogs for more insightful content.\u00a0<\/span><\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Flex is the value of the css display property. By using a flex in the parent, the child elements are automatically shaped like a line or column with their respective initial width and height. Properties of Flex Container 1.Display Flex: CSS Display property can have value flex or inline-flex. By using display flex or inline-flex [&hellip;]<\/p>\n","protected":false},"author":1505,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":4},"categories":[3429],"tags":[245,5370,5369,3259,379],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58053"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1505"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=58053"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58053\/revisions"}],"predecessor-version":[{"id":58186,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58053\/revisions\/58186"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=58053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=58053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=58053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}