<?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 Ben Mechlia Nadia on Medium]]></title>
        <description><![CDATA[Stories by Ben Mechlia Nadia on Medium]]></description>
        <link>https://medium.com/@nadia.mechlia?source=rss-985918f4f03c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iNf-OEJF3hrntpwA-MV1EQ@2x.jpeg</url>
            <title>Stories by Ben Mechlia Nadia on Medium</title>
            <link>https://medium.com/@nadia.mechlia?source=rss-985918f4f03c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 03:16:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nadia.mechlia/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[Why Flexbox?]]></title>
            <link>https://medium.com/@nadia.mechlia/why-flexbox-22932203bca3?source=rss-985918f4f03c------2</link>
            <guid isPermaLink="false">https://medium.com/p/22932203bca3</guid>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[bem]]></category>
            <category><![CDATA[flex]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[style]]></category>
            <dc:creator><![CDATA[Ben Mechlia Nadia]]></dc:creator>
            <pubDate>Mon, 01 Apr 2019 08:49:57 GMT</pubDate>
            <atom:updated>2019-04-01T08:49:57.880Z</atom:updated>
            <content:encoded><![CDATA[<h4>Best way to create a flexible view!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2vpDodCxD3KvRZd0hAAbfQ.png" /></figure><blockquote>Why Flexbox?</blockquote><p>Flexbox let it more flexible for a developer to positioning items in a container with the minimum of code.</p><blockquote>Global idea</blockquote><p>Flexbox, in general, is composed of a container with property `display: flex;`, and with this property, the container decides for itself how to display its items. we talk here about a parent: container and its children: items.</p><blockquote>Link to project: flexbox examples</blockquote><p><a href="https://github.com/nadiamechlia/flexbox-demo">nadiamechlia/flexbox-demo</a></p><blockquote>See the difference</blockquote><p>We have four divs(items) in a container div(parent) with different sizes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*r5Khy4PGsGEX5vvQ3tn9dQ.png" /></figure><ul><li>With parent style: ‘display: block;’</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*ROULQZX8NLd1VKGbmzkCug.png" /></figure><ul><li>With parent style: ‘display: flex;’</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*wCZJG6T9u-w_LBePBom_fw.png" /></figure><p>— With ‘display: block;’ each div takes the full width of its line, but with ‘display: flex;’ the items are displayed inline.</p><p>It doesn’t seem like a big hit, but you’ll discover the power of flexbox in the next examples.</p><blockquote>Example#1: Child item in the centre of the parent.</blockquote><p>With Flexbox the struggle of putting an item in the center of the parent div is resolved:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*cgJ558mDb42oLdZO7pzN5g.png" /></figure><p>— In this example, the parent div has background color gray, and the child item is the pink one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*d8PaVMgF4WpBlN9AkcsCYQ.png" /></figure><p>The flexbox allows the container (parent div) to position its items based on two axes:</p><ul><li>horizontally with ‘justify-content’ : flex-start, flex-end, center, space-between, space-around …</li><li>vertically with ‘align-items’: flex-start, flex-end, center, stretch, baseline</li></ul><blockquote>Example#2: Set for each child item its width.</blockquote><p>Like Bootstrap grid system, Flexbox gives you the possibility to set the responsive tiers to the container’s items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKzmejSMSQaosICQMUer_A.png" /></figure><p>— In this example, we set the width of the child items with the propriety assigned to each child item ‘flex-basis’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*IdJngjIawFkLXFxQ3UO2gg.png" /></figure><ul><li>each child has its flex-basis percentage and the sum of all the items flex-basis values should be equal to 100%.</li></ul><blockquote>Example#3: The utility of ‘flex-wrap’</blockquote><p>Since by default, the items will try to fit onto one line, the flex-wrap as its name indicate, let the items be wrapped when needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*qyhU9nU8jvQWGUuBB9dChA.png" /></figure><p>— The difference between the example#2 and example#3 is that we add a ‘min-width: 250px;’ to the first item (pink item) and property ‘flex-wrap: wrap’ to the parent div.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*9Hobg3tMEQXKLomvvC6zsw.png" /></figure><ul><li>The ‘flex-wrap’ default value is ‘no-wrap’. Other values: wrap, wrap-reverse.</li></ul><blockquote>Example#4: It’s easy to set a direction to children.</blockquote><p>As we said before, the flex lets the children displayed inline (as a row). But it gives you the opportunity to display the content items in a column, and even reverse its direction from right to left (the default from left to right).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*jinZwEo2L5pWUD4G2ScnUw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*-uLMMI6zRd26ff02h54rnw.png" /></figure><ul><li>‘flex-direction: column’</li><li>‘flex-direction: column-reverse’</li></ul><p>Above, we give the basic use cases of the flexbox, but the flexbox still has too many other magical properties like:</p><ul><li>order: (child property) To order the items appearance order in the parent container.</li><li>align-self: (child property) To set the child default alignment compared to the parent.</li><li>align-content: (parent-property) similar to justify-content property.</li></ul><p>— The link below will help you to discover more the flexbox proprieties.</p><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><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22932203bca3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>