<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rasheed Mammadlee on Medium]]></title>
        <description><![CDATA[Stories by Rasheed Mammadlee on Medium]]></description>
        <link>https://medium.com/@mcmizze?source=rss-9dae0d0c6787------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*rvcdeKLr9KMmIDi4toVmPQ.jpeg</url>
            <title>Stories by Rasheed Mammadlee on Medium</title>
            <link>https://medium.com/@mcmizze?source=rss-9dae0d0c6787------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:59:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mcmizze/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[5 Most Common Situations that FlexBox overcomes easily]]></title>
            <link>https://medium.com/@mcmizze/5-most-common-situations-that-flexbox-overcomes-easily-52df1cdc23db?source=rss-9dae0d0c6787------2</link>
            <guid isPermaLink="false">https://medium.com/p/52df1cdc23db</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html-css]]></category>
            <category><![CDATA[layout]]></category>
            <dc:creator><![CDATA[Rasheed Mammadlee]]></dc:creator>
            <pubDate>Thu, 21 May 2020 18:19:18 GMT</pubDate>
            <atom:updated>2020-05-21T18:19:18.273Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Programmer writes code using laptop" src="https://cdn-images-1.medium.com/max/1024/1*JeRhVzpHZGaiCzJyWg0NDQ.jpeg" /></figure><p>Flexbox made the web developer’s life easier by adding several useful CSS properties. Here is the list of techniques that web programmers used to build their page before:</p><ul><li>Floats</li><li><em>block</em>, <em>inline</em>, and <em>table</em> display values</li><li>Using the <em>position</em> property</li></ul><p>These methods required extra adjustments for controlling spacing, box sizes, and responsiveness. So using only them was error-prone and took more time to make it work well. That was one of the main reasons why the Flexbox layout module added to CSS.</p><p>Flexbox gives you the ability to align, position, and control available space for its items. Even if you resize the window of your browser, it helps your elements to behave as you want.</p><p>Now, let’s talk about the scenarios where Flexbox is very handy to use and situations when it is the only safe way of implementing your idea.</p><h3>Layout</h3><p>By declaring the display value of the parent element as <em>flex</em>, you can obtain great control over its child elements (<em>flex-items</em>). Now you can define its layout very easily and quickly. Using <a href="https://www.w3schools.com/cssref/css3_pr_flex-flow.asp"><em>flex-flow</em></a> property, you can define a direction and wrapping logic for its flex-items. Flexbox properties like <a href="https://www.w3schools.com/cssref/css3_pr_align-items.asp"><em>align-items</em></a> and <a href="https://www.w3schools.com/cssref/css3_pr_justify-content.asp"><em>justify-content</em></a> will help you align child elements horizontally and vertically. You can also use <em>the justify-content </em>property to distribute space among flex-items.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dH_ssiUbXSgI6pge3MHNOA.png" /><figcaption>Flex container with flex-flow: row nowrap; align-items: center; and justify-content: space-around; CSS declerations</figcaption></figure><h3>Perfect centering with flex</h3><p>One of the most common problems in styling is centering an element properly. Flexbox makes it very easy if you set both the <em>align-items</em> and <em>justify-content </em>properties to the <em>center</em>. No matter the direction of the elements is <em>column </em>or <em>row,</em> you will get your elements centered perfectly.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3S9403r-dd1MFE8pquYXVw.png" /><figcaption>Flex container with | flex-direction: column; align-items: center; and justify-content: center; | CSS declerations</figcaption></figure><h3>Box size control</h3><p>There are some situations that you want to control the size of your elements automatically. To make them always fill all the available space of the parent element or to make them grow and shrink as much as you want. There are properties for the flex element and its items that will help you to get rid of this.</p><p>The first property we going to use is <em>align-item</em>. Its default value is <em>stretch,</em> and it makes your elements fill the all available space depending on the direction. But things change when you use other values like <em>flex-start, center, flex-end, </em>and <em>baseline. </em>Using these values make your elements to be in original size, but shift them to the direction you choose. Let’s change the <em>align-items </em>value of the previous example to be stretch.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pBlssJmAPCyKSySqM9EU4w.png" /><figcaption>Flex container with | flex-direction: column; align-items: stretch; and justify-content: center; | CSS declerations</figcaption></figure><p>The second property is <a href="https://www.w3schools.com/cssref/css3_pr_flex.asp"><em>flex</em></a><em>. </em>It is about defining whether<em> flex-item</em> can grow or shrink and what is the initial length for it. This is a shorthand property for <a href="https://www.w3schools.com/cssref/css3_pr_flex-grow.asp"><em>flex-grow</em></a>, <a href="https://www.w3schools.com/cssref/css3_pr_flex-shrink.asp"><em>flex-shrink</em></a>, and <a href="https://www.w3schools.com/cssref/css3_pr_flex-basis.asp"><em>flex-basis</em></a>. One of the most common uses for <em>flex</em> property is styling a card. Typically cards have an image at the top then the other contents like paragraph and button. The<em> flex </em>property is very handy to use in this scenario.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SH1EeODxqqqPIprFgK7DWg.png" /><figcaption>Flex items with | flex | properties</figcaption></figure><h3>Elements order</h3><p>Sometimes we need to define special order rather than using natural element declaration order. Flexbox module makes this possible by its <a href="https://www.w3schools.com/cssref/css3_pr_order.asp"><em>order</em></a> property. We can simply define an order for the flex-item by adding <em>order</em> property with its order value. The item with lower order value takes priority over higher ones.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k74uitNsyITyCaqwSgjI2g.png" /><figcaption>Flex items with different order values</figcaption></figure><h3>Responsiveness</h3><p>When the display value of an element defined as <em>flex</em>, its child elements become responsive. This is because of the default values of <em>align-items</em> and <em>flex</em> properties. The first one makes flex-items stretch until you define some other value for this property. But if you change its value to <em>flex-start</em>, for example, it won’t be as wide as the parent element anymore. Now, if you resize the window of your browser, you can see that flex-items still responsive and changing their size. But this time it is not getting bigger, but shrinking when you decrease the size. That is because the default value for <em>flex</em> property is <em>0 1 auto.</em> You can see that the first value representing <em>flex-grow </em>is <em>0</em>. That means flex-item is not going to grow when it has the available space. The second value is representing <em>flex-shrink,</em> and it is set to <em>1</em> by default. That means flex-item will get smaller if the size of its parent gets smaller.</p><p>To make your items always fill the available space, use the<em> flex: 1</em> option. It is the same as adding <em>flex: 1 1 auto</em>. If you have more than one flex-items, space will be divided and filled.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bjj5J24A6Kz132HJl73pVw.png" /><figcaption>Stretchy flex items with | flex: 1 | CSS declaration</figcaption></figure><p>To make your items not to change the size, and not to be responsive at all use <em>flex: none </em>and define a fixed size for them<em>. </em>This will keep flex-item always in the original size.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLV4EN-os-MzM1sPqgmw_g.png" /><figcaption>Fixed-size (w 200px h 200px) flex-items with | flex: none | CSS declaration</figcaption></figure><h3>Conclusion</h3><p>Now you know how much the Flexbox module is handy, and what are the best situations to use it. Of course, we can also use the Grid module in some cases, but it is nice practice to use Flexbox for small scale layouts and components of your page. In this article, I tried to show the best cases when Flexbox is most appropriate to use. I hope this information will help you improve your style and to be more confident about building a layout. If you want to dig deeper, check out the references at the end of the article.</p><p>Happy coding!</p><h3>References</h3><p><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">https://css-tricks.com/snippets/css/a-guide-to-flexbox/</a></p><p><a href="https://www.w3schools.com/css/css3_flexbox.asp">https://www.w3schools.com/css/css3_flexbox.asp</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox">https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52df1cdc23db" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>