<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: hinanshi suthar</title>
    <description>The latest articles on DEV Community by hinanshi suthar (@hinanshis4).</description>
    <link>https://dev.to/hinanshis4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F686640%2F6a1ef022-76c3-427e-acda-368659fb3abd.jpg</url>
      <title>DEV Community: hinanshi suthar</title>
      <link>https://dev.to/hinanshis4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hinanshis4"/>
    <language>en</language>
    <item>
      <title>CSS flexbox made simple!</title>
      <dc:creator>hinanshi suthar</dc:creator>
      <pubDate>Sun, 15 Aug 2021 17:58:24 +0000</pubDate>
      <link>https://dev.to/hinanshis4/css-flexbox-made-simple-n87</link>
      <guid>https://dev.to/hinanshis4/css-flexbox-made-simple-n87</guid>
      <description>&lt;p&gt;Do you ever think why is body flexibility important? Because it helps in improving posture, balance and overall performance. Similarly, FLEXBOX or FLEXIBLE BOX LAYOUT in CSS helps us to balance the overall design effectively. Thus, it provides a more efficient way to layout and distribute space among the flex-items.&lt;/p&gt;

&lt;p&gt;But first, why flexbox and not the old box model for CSS?&lt;/p&gt;

&lt;p&gt;For instance, if you want to arrange let's say, 3 columns in a single row. Using the old box model, you use the property called float and specify a %(percentage) or a fixed width.&lt;/p&gt;

&lt;p&gt;Flexbox provides an easy way to arrange items without having to rely on a combination of floats and widths to make things responsive. By specifying parent properties, flexbox makes easy to CSS components like columns, navigation bars and menus. The flex layout goes for flex-directions rather than block and inline flow.&lt;/p&gt;

&lt;p&gt;Usually, a flex-container which carries all the items is known as a Parent Property and the items in flex-container are called the child properties.&lt;/p&gt;

&lt;h3&gt;
  
  
  Parent Properties
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Display
&lt;/h4&gt;

&lt;p&gt;can be inline or it can also be inline flex.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex; /* or inline-flex */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  flex-direction
&lt;/h4&gt;

&lt;p&gt;used to determine the direction of the items within the container itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  flex-direction: row | row-reverse | column | column-reverse;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  flex-wrap
&lt;/h4&gt;

&lt;p&gt;Used to wrap items in a single line(by default)&lt;br&gt;
wrap: flex items will wrap into multiple lines starting from top to bottom.&lt;br&gt;
wrap-reverse: flex items will wrap into multiple lines but in a reverse order. (i.e. bottom to top)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  flex-wrap: nowrap | wrap | wrap-reverse;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  flex-flow
&lt;/h4&gt;

&lt;p&gt;Use to set both flex-wrap and flex-direction altogether.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  flex-flow: column wrap;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  justify-content
&lt;/h4&gt;

&lt;p&gt;It aligns the items across the main axis as required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  justify-content: flex-start | flex-end | center | space-between | space-around | space-evenly | start | end | left | right ... + safe | unsafe;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Child Properties
&lt;/h3&gt;

&lt;h4&gt;
  
  
  flex-items
&lt;/h4&gt;

&lt;p&gt;It controls the order in which they appear in the container. '0' being the default value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.item {
  order: 5;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  flex-grow
&lt;/h4&gt;

&lt;p&gt;It is the ability for a flex item to expand if required. Again, '0' being the default value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.item {
  flex-grow: 4;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  flex-shrink
&lt;/h4&gt;

&lt;p&gt;This defines the ability for a flex item to shrink if necessary. Basically, opposite of flex-grow. '1' is the default value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.item {
  flex-shrink: 3;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hang in there dev, there's much more to this. If you want to know more Parent and Child properties, comment down it will be there soon!!&lt;/p&gt;

</description>
      <category>css</category>
      <category>frontenddev</category>
      <category>flexbox</category>
      <category>flexboxhelp</category>
    </item>
  </channel>
</rss>
