<?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"><channel><title><![CDATA[Education for Web Developers]]></title><description><![CDATA[Learn CSS, JavaScript, React, Node, MongoDB, and much more!]]></description><link>https://blog.bytegrad.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1634089253743/oxVBmReAQ.png</url><title>Education for Web Developers</title><link>https://blog.bytegrad.com</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 08:28:24 GMT</lastBuildDate><atom:link href="https://blog.bytegrad.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[CSS3 Border Box (Example + Illustration)]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
To understand the "box-sizing: border-box" declaration...]]></description><link>https://blog.bytegrad.com/css3-border-box-example-illustration</link><guid isPermaLink="true">https://blog.bytegrad.com/css3-border-box-example-illustration</guid><category><![CDATA[CSS]]></category><category><![CDATA[CSS3]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Sat, 13 Nov 2021 16:27:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636816819999/4s8Ny96r2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>To understand the "box-sizing: border-box" declaration in CSS3, see this illustration (open in new tab to see it bigger):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636818666492/pcrh4vDzg.png" alt="CSS Box-Sizing Content-Box Border-Box.png" /></p>
<p>To fully understand it (this is the most difficult property in CSS), you should understand the box model in CSS.</p>
<p>Every HTML element has a box model. For example, this is a paragraph-element on some page:
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636818858753/yrwzIB8jO.png" alt="Box-Model.png" /></p>
<p>The blue color alone is the 'content-box'. The size of the content-box is simply determined by the space that the text takes up. So, if you have a lot of text or a large font-size, this will increase the content-box. But it is also influenced by the characteristics of the font that you use (e.g. how much space a certain character actually takes up).</p>
<p>The green PLUS the blue color is the 'padding-box'.</p>
<p>The yellow PLUS the green PLUS the blue color is the 'border-box'.</p>
<p>Around the border, there is margin. But margin is not considered to be part of an element, it's space between elements. So we don't have a 'margin-box'.</p>
<p>The tricky part in practice with this is when you set a width or height.</p>
<p>If you set <code>width: 100px</code> on some HTML-element, what exactly should be 100px? The content-box, padding-box or border-box?</p>
<p>The default is content-box. Which means if you set <code>width: 100px</code> on some HTML-element, and you also have some padding and/or a border, the TOTAL width is bigger than 100px.</p>
<p>For example, <code>width: 100px</code> is 100px for content PLUS 20px for left-side-padding + 20px for right-side-padding PLUS 5px for left-side-border + 5px for right-side-border = 150px width in TOTAL.</p>
<p>This is very confusing in practice, because when we set <code>width: 100px</code> on some HTML-element we expect that to be the TOTAL width of the element. At least, that would be much easier to work with.</p>
<p>So to make <code>width: 100px</code> the actual TOTAL width of the element, we use <code>box-sizing: border-box</code>. Now when you set a width (or height), the border-box is that width (or height).</p>
<p>For example, by setting <code>width: 100px</code>, the browser knows that the TOTAL width of the element should be 100px. So if we have 40px for left- and right-side padding + 10px for left- and right-side border, that means there is 50px left for the width of the content. </p>
<p>So the browser will force the width of the content to be 50px, making sure that the TOTAL width of the element is 100px.</p>
<p>And again, margin is not taken into account, because it's not considered part of an element, but space between elements.</p>
<p>Also, you will often see people use this in their CSS reset, like this simple reset:</p>
<pre><code>*,
*<span class="hljs-selector-pseudo">::before</span>,
*<span class="hljs-selector-pseudo">::after</span> {
  <span class="hljs-attribute">margin</span>: <span class="hljs-number">0</span>;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">0</span>;
  <span class="hljs-attribute">box-sizing</span>: border-box;
}
</code></pre><p>With the universal selector (<code>*</code>), we select all HTML elements except pseudo-elements, so we also select those individually with <code>*::before</code> and <code>*::after</code>. </p>
<p>Then set their box-sizing property to 'border-box', which is the only other option you have apart from the default 'content-box'.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[Flexbox Properties: Most Common + Rare Properties]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
Here's a list of the most common properties you will u...]]></description><link>https://blog.bytegrad.com/flexbox-properties-most-common-rare-properties</link><guid isPermaLink="true">https://blog.bytegrad.com/flexbox-properties-most-common-rare-properties</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 23:42:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636674166550/2lsjKuQPd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>Here's a list of the most common properties you will use in Flexbox (from my own experience) -- try opening in a new tab for bigger version:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636673840799/Gw8eU87a4.png" alt="Flexbox_ most common properties.png" /></p>
<p>Here's a list of more rare properties with a brief explanation:</p>
<ol>
<li><p><code>align-content</code> -- use this instead of <code>align-items</code> when you have multiple rows/columns (which you will have when flex-items have wrapped onto new lines).</p>
</li>
<li><p><code>order</code> -- use this to change the order of flex-items. This is something you want to do sometimes when you make your project responsive. Some flex-item may then fall below another flex-item, because limited space on e.g. mobile forces everything into a 1-column layout, and you don't want that flex-item to sit below another one. This property works with a number, the lowest numbers come first in the order.</p>
</li>
</ol>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[Flexbox Spacing Between Items: Examples]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
In the past, if you wanted to create space between fle...]]></description><link>https://blog.bytegrad.com/flexbox-spacing-between-items-examples</link><guid isPermaLink="true">https://blog.bytegrad.com/flexbox-spacing-between-items-examples</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 23:26:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636673176539/c2tH16_DP.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>In the past, if you wanted to create space between flex-items, you had to use the good ol' margin property.</p>
<p>That came with certain issues, so today we have a better solution: the 'gap'-properties.</p>
<p>These actually come from CSS Grid, but since Flexbox and CSS Grid are being harmonized (so we can use the same properties in both systems) we can now also use these with Flexbox.</p>
<p>So there is <code>column-gap</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636673022924/G74-4FFFA.png" alt="CSS Flexbox default layout with column-gap.png" /></p>
<p>And <code>row-gap</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636673040396/OV6XLCCSf.png" alt="CSS Flexbox default layout with row-gap.png" /></p>
<p>And <code>gap</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636673053792/4TdPYkkbj.png" alt="CSS Flexbox default layout with gap.png" /></p>
<p>These properties were previously called 'grid-column-gap', 'grid-row-gap' and 'grid-gap', but like I said, they're now available in Flexbox too so the 'grid-' prefix was dropped.</p>
<p>Note that the 'gap'-properties <a target="_blank" href="https://caniuse.com/?search=column-gap">won't work properly in Internet Explorer</a>.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[Flex Container HTML: Example]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
Flexbox is always about a so-called flex-container and...]]></description><link>https://blog.bytegrad.com/flex-container-html-example</link><guid isPermaLink="true">https://blog.bytegrad.com/flex-container-html-example</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 23:18:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672662930/QaJ30iXNd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>Flexbox is always about a so-called flex-container and its direct child elements -- which we call the flex-items.</p>
<p>In HTML this means there will be one HTML-element that will be the flex-container and its direct child elements in the HTML tree will be the flex-items.</p>
<p>The only thing we have to do to 'unlock' the functionalities of Flexbox is setting <code>display: flex</code> on the HTML element that we want to use as a flex-container:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672590073/DHc_Khp1M.png" alt="CSS Flexbox default layout (2).png" /></p>
<p>When you do that, this is the default layout that is created.</p>
<p>The flex-items will sit on the same row, flowing from left to right.</p>
<p>We can now use other Flexbox-properties, like <code>justify-content</code>, <code>align-items</code>, etc. to position the flex-items like we want.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[Flexbox Examples: Most Common Layouts (+ Illustrations)]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
To 'unlock' the functionalities of Flexbox, simply pic...]]></description><link>https://blog.bytegrad.com/flexbox-examples-most-common-layouts-illustrations</link><guid isPermaLink="true">https://blog.bytegrad.com/flexbox-examples-most-common-layouts-illustrations</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 23:13:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672409254/jaOr6uZZt.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>To 'unlock' the functionalities of Flexbox, simply pick an element and use <code>display: flex</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636671993288/RPJBGEtxT.png" alt="CSS Flexbox default layout (1).png" /></p>
<p>This will give you the default layout.</p>
<p>The element with <code>display: flex</code> is the flex-container and its direct child elements are called the flex-items.</p>
<p>The flex-items are laid out horizontally next to each other in the default layout.</p>
<p>We can position these flex-items somewhere else, horizontally or vertically.</p>
<p>For example, horizontally we can do this by using <code>justify-content</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672071024/lg5KPRwck.png" alt="CSS Flexbox default layout justify-content center.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672075626/XGV6RQcmR.png" alt="CSS Flexbox default layout justify-content end.png" /></p>
<p>And vertically we can use <code>align-items</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672110601/yGfWK7K3f.png" alt="CSS Flexbox justify-content center and align items center.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672114801/Ww0-3lWv-.png" alt="CSS Flexbox justify-content center and align items end.png" /></p>
<p>Notice how the flex-items now always flow horizontally, they go from left to right.</p>
<p>Sometimes we want them to flow vertically, from top to bottom.</p>
<p>We can do that with <code>flex-direction: column</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672166809/ZdI8elQUG.png" alt="CSS Flexbox Default Layout When using flex-direction column (4).png" /></p>
<p>Then we can use <code>justify-content</code> and <code>align-items</code> again to position them differently, <strong>however now their axes have 'flipped'</strong>.</p>
<p>So now you need to use <code>justify-content</code> for the <strong>vertical</strong> axis and <code>align-items</code> for the <strong>horizontal axis</strong>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672220659/oeV-LHzUL.png" alt="CSS Flexbox flex direction column with align-items center.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672227489/QqnDCPcYt.png" alt="CSS Flexbox flex direction column with align-items center and justify-content end.png" /></p>
<p>Sometimes we just want to move 1 flex-item to a different position.</p>
<p>Select that one element and use <code>align-self</code> or <code>margin: auto</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672259893/Z2Omx1XZb.png" alt="CSS Flexbox display flex align-self center.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672272758/WkQvl-IiK.png" alt="CSS Flexbox display flex margin auto (1).png" /></p>
<p>Also, if you have many flex-items or very large flex-items such that they do not fit, they will overflow the container or stretch the container out. You can make them wrap with <code>flex-wrap: wrap</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672311616/W3ULTvGoB.png" alt="CSS Flexbox flex wrap wrap.png" /></p>
<p>And now if you want to position everything along the vertical axis, you should use <code>align-content</code> instead of <code>align-items</code> (use align-content when you have multiple rows/columns like we have now after wrapping):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636672355201/BpkP0l54O.png" alt="CSS Flexbox flex wrap wrap and align-content center.png" /></p>
<p>I cheated a bit in the illustrations by giving the flex-items some space between them. In practice you need to use one of the gap properties to achieve that: <code>column-gap</code>, <code>row-gap</code> or <code>gap</code>.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter  <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[Flexbox Layout Examples: Most Common Layouts]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
This is the default layout in Flexbox:

You set displa...]]></description><link>https://blog.bytegrad.com/flexbox-layout-examples-most-common-layouts</link><guid isPermaLink="true">https://blog.bytegrad.com/flexbox-layout-examples-most-common-layouts</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 22:47:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670814967/lFc_75k4q.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>This is the default layout in Flexbox:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636669771912/-fRNvjOQ7.png" alt="CSS Flexbox default layout (1).png" /></p>
<p>You set <code>display: flex</code> on an element. This makes that element the so-called flex-container and its direct child elements the so-called flex-items.</p>
<p>The flex-items are laid out horizontally next to each other, starting from the top-left corner.</p>
<p>Sometimes this is all you need.</p>
<p>However, let's say we want to position these flex-items differently. We have 2 major options: we can position them along the horizontal axis or the vertical axis.</p>
<p>To position the flex-items along the horizontal axis, use <code>justify-content</code> here:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670208138/0Fq9TentA.png" alt="CSS Flexbox default layout justify-content center.png" /></p>
<p>or</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670230939/FU0hJSLZy.png" alt="CSS Flexbox default layout justify-content end.png" /></p>
<p>Note that <code>flex-end</code> has better browser support at time of writing, but is being phased out in favor of <code>end</code>. This is because Flexbox and CSS Grid properties are being harmonized, so we can use the same properties in both systems. That's why the 'flex-' and 'grid-' prefixes are being dropped.</p>
<p>We can also align the flex-items vertically with <code>align-items</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670354575/MXC0xmYB9.png" alt="CSS Flexbox justify-content center and align items center.png" /></p>
<p>or</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670373015/zMqbQn_Nq.png" alt="CSS Flexbox justify-content center and align items end.png" /></p>
<p>With Flexbox, the flex-items are always laid out along 1 direction: horizontal (row) or vertical (column). The default is horizontal (row).</p>
<p>However, sometimes we want it to be vertical (column):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670431846/NyNIm_pH9.png" alt="CSS Flexbox Default Layout When using flex-direction column (4).png" /></p>
<p>When you do that, the <code>align-items</code> and <code>justify-content</code> properties 'flip', so now <code>justify-content</code> works for the vertical axis and <code>align-items</code> for the horizontal axis:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670473849/K_ZeLfyU1.png" alt="CSS Flexbox flex direction column with align-items center.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670491076/X-y4srgtj.png" alt="CSS Flexbox flex direction column with align-items center and justify-content end.png" /></p>
<p>Sometimes, we only want to position 1 flex-item in a certain way, not all flex-items. We can do that by selecting that individual flex-item and using <code>align-self</code> instead of <code>align-items</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670546158/9jMNmJrOT.png" alt="CSS Flexbox display flex align-self center.png" /></p>
<p>For the other axis, there is no <code>justify-self</code>. Instead we should use <code>margin: auto</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670583288/SYcF36pOD.png" alt="CSS Flexbox display flex margin auto (1).png" /></p>
<p>Here, margin will take up all the space left to the flex-item, pushing the flex-item itself all the way to the right.</p>
<p>Sometimes, you will have more flex-items than here or just a few very large ones. In that case, they may overflow the container or stretch the container out. Instead of that, you probably want them to wrap onto a new line if they don't fit.</p>
<p>Use <code>flex-wrap: wrap</code> to do that:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670685489/HN6Z-5jO8.png" alt="CSS Flexbox flex wrap wrap.png" /></p>
<p>Here we have multiple rows now. If we want to center all of this vertically like before, we now have to use <code>align-content</code> instead of <code>align-items</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636670760219/IGop1Lr5w.png" alt="CSS Flexbox flex wrap wrap and align-content center.png" /></p>
<p>So use <code>align-items</code> when you have 1 row or column, use <code>align-content</code> when you have multiple rows or columns (after wrapping).</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[Nested Flexbox: Examples]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
You can nest Flexbox without problem. It works exactly...]]></description><link>https://blog.bytegrad.com/nested-flexbox-examples</link><guid isPermaLink="true">https://blog.bytegrad.com/nested-flexbox-examples</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 22:21:03 GMT</pubDate><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>You can nest Flexbox without problem. It works exactly as expected.</p>
<p>An example:</p>
<pre><code class="lang-plaintext">&lt;div class="container"&gt;
  &lt;ul class="list"&gt;
    &lt;li class="list__item"&gt;List item 1&lt;/li&gt;
    &lt;li class="list__item"&gt;List item 2&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</code></pre>
<pre><code class="lang-plaintext">.container {
  height: 500px;
  width: 500px;
  background-color: rgb(233, 236, 237);

  display: flex;
  justify-content: center;
  align-items: center;
}

.list {
   display: flex;
   column-gap: 50px;
}
</code></pre>
<p>Which produces this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636669006493/Dem2A-Z-d.png" alt="nested flexbox example.png" /></p>
<p>The list element is a flex-item in relation to the container, <strong>but it is also a flex-container in relation to its own child elements</strong>.</p>
<p>This works as expected, no problem.</p>
<p>This is because Flexbox is always about a flex-container and its direct child elements (so only the child elements that are a direct descendant in the HTML tree).</p>
<p>And a child element can be both a flex-item in relation to its parent, and it can be a flex-container itself in relation to its own direct child elements.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[Flexbox Align Content: Examples]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
Let's start with the default layout in Flexbox:

If we...]]></description><link>https://blog.bytegrad.com/flexbox-align-content-examples</link><guid isPermaLink="true">https://blog.bytegrad.com/flexbox-align-content-examples</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 22:02:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636668125296/8aS48e1ns.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>Let's start with the default layout in Flexbox:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636667822268/sQy83nq4L.png" alt="CSS Flexbox default layout.png" /></p>
<p>If we want to center all of these flex-items vertically, we can simply use <code>align-items: center</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636667879406/24INq2byt.png" alt="CSS Flexbox align items center.png" /></p>
<p>However, what happens if we have many more flex-items? Or flex-items that are much bigger? Then we probably want them to wrap onto new lines if they don't fit:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636667978386/g-w5B4jRP.png" alt="CSS Flexbox default layout with flex-wrap wrap.png" /></p>
<p>Now, how do we vertically center all flex-items properly like before?</p>
<p>We have to use <strong>align-content</strong>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636668052594/sqzGfYIn6.png" alt="CSS Flexbox align content center.png" /></p>
<p>Conclusion: use <code>align-items</code> when you have just 1 row (or 1 column, in case you use <code>flex-direction: column</code>), use <code>align-content</code> when your flex-items have wrapped onto new lines so that you have more than 1 row or 1 column.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter  <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[Webkit Flexbox: Why Use -Webkit- Prefix?]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
With Flexbox you can use multiple properties, for exam...]]></description><link>https://blog.bytegrad.com/webkit-flexbox-why-use-webkit-prefix</link><guid isPermaLink="true">https://blog.bytegrad.com/webkit-flexbox-why-use-webkit-prefix</guid><category><![CDATA[flexbox]]></category><category><![CDATA[CSS]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 21:49:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636667329619/uYTSIFX_k.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>With Flexbox you can use multiple properties, for example:</p>
<pre><code><span class="hljs-selector-class">.flex-container</span> {
  <span class="hljs-attribute">display</span>: flex;
  <span class="hljs-attribute">align-items</span>: center;
}
</code></pre><p>This will work in 99.14% of cases, according to  <a target="_blank" href="https://caniuse.com/?search=display%20flex">Can I Use</a>. </p>
<p>In some old browser versions it won't work like this. You need to add a so-called prefix to the properties to make them work.</p>
<p>Prefixes are like '-webkit-' for webkit-based browsers, like Safari or older versions of Chrome.</p>
<p>Or -moz- for Firefox.</p>
<p>Or -ms- for Internet Explorer.</p>
<p>Years ago, browsers used these prefixes to indicate these properties were for testing. </p>
<p>For example, in Chrome version 28 you as a developer could start playing around / testing flexbox properties by using e.g. <code>-webkit-align-items: center</code>.</p>
<p>These prefixes were added because maybe later, after experimenting, the standardization process would change the name of these properties. So with a prefix it would clearly indicate that it was for experimental purposes only.</p>
<p>Then in Chrome version 29 you could start using <code>align-items: center</code>, without prefix.</p>
<p>However, some people never upgraded their browser to version 29. So they are still on e.g. Chrome version 28.</p>
<p>Reasons could be corporate computers that have a stricter updating process that never got around to it. People who use (old) software that only works on older versions and don't want to update their browser version because they might look access to that software or would be forced to pay for the software.</p>
<p>So for that super small percentage of people who are on those older browser versions, we should still use prefixes, so that it works in their browsers too.</p>
<p>You probably don't want to do that manually, so there is open-source software that will do it for you automatically, like  <a target="_blank" href="https://github.com/postcss/autoprefixer">Autoprefixer</a>. You can use that as an NPM-package.</p>
<p>That will upgrade the above example from 99.14% to 99.7% coverage.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter  <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[Display Flex Align Items: Tutorial (Examples)]]></title><description><![CDATA[https://youtu.be/_ERtW0z3FF0
 
You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
To start using Flexbox,...]]></description><link>https://blog.bytegrad.com/display-flex-align-items-tutorial-examples</link><guid isPermaLink="true">https://blog.bytegrad.com/display-flex-align-items-tutorial-examples</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 21:26:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665965033/5ufQnUW_O.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/_ERtW0z3FF0">https://youtu.be/_ERtW0z3FF0</a></div>
<p> </p>
<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>To start using Flexbox, you only have to use <code>display: flex</code> on an element. That will give you this default layout:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665371768/tw9PL599B.png" alt="CSS-Flexbox-Default-Layout (3).png" /></p>
<p>The element with <code>display: flex</code> will become the so-called flex-container, and its direct child elements become the flex-items.</p>
<p>We have now 'unlocked' Flexbox functionalities.</p>
<p>We can then use <code>align-items</code> to determine where along the vertical axis all the flex-items should be positioned.</p>
<p>For example, to position them in the center:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665495408/93QbG_r9G.png" alt="CSS-Flexbox-Display Flex Align Items center.png" /></p>
<p>Or at the bottom:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665534390/L7tXRMjrt.png" alt="CSS-Flexbox-Display Flex Align Items end.png" /></p>
<p>Note that we used <code>end</code> here, but <code>flex-end</code> has better browser support. However, <code>flex-end</code> is being phased out, because the Flexbox &amp; CSS Grid properties are being harmonized (so we can use the same properties in both systems). So the 'flex-' and 'grid-' prefixes get cut.</p>
<p>When you use <code>flex-direction: column</code> to change the direction that the flex-items should follow, things change.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665658330/dvD6ja0Qp.png" alt="CSS Flexbox Default Layout When using flex-direction column (3).png" /></p>
<p>Now 'align-items' doesn't determine where flex-items should be positioned along the vertical axis, but along the horizontal axis. And the <code>justify-content</code> property, that we haven't discussed here yet but is what you would use for horizontal positioning in the default situation, is now used for vertical alignment.</p>
<p>So things 'flip' when you use <code>flex-direction: column</code>.</p>
<p>If we now use <code>align-items: center</code>, we get this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665800133/JKT4KaF30U.png" alt="CSS Flexbox Flex direction column align items center.png" /></p>
<p>If you just want to align an individual flex-item, you can use <code>align-self</code>. An example:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665879719/qlSsdTZCC.png" alt="CSS-Flexbox-Display Flex Align Items center align-self end.png" /></p>
<p>Remember, when <code>flex-direction: column</code>, things switch:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636665919694/kwKI5hcGo.png" alt="CSS Flexbox Flex direction column align items center align self end.png" /></p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
]]></content:encoded></item><item><title><![CDATA[CSS Flex Align Vertical: Tutorial (Examples + Illustrations)]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
To understand vertical aligning in Flexbox, let's star...]]></description><link>https://blog.bytegrad.com/css-flex-align-vertical-tutorial-examples-illustrations</link><guid isPermaLink="true">https://blog.bytegrad.com/css-flex-align-vertical-tutorial-examples-illustrations</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 18:46:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636656384928/WbVoazl6V.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>To understand vertical aligning in Flexbox, let's start from the default layout in Flexbox:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636655620971/lP_ihlUvE.png" alt="CSS-Flexbox-Default-Layout (2).png" /></p>
<p>We can use <code>align-items</code> to determine where along the vertical axis all flex-items should sit. For example, if we want them to sit in the center:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636655712933/lDeJQe5uq.png" alt="CSS-Flexbox-Vertical Align with align-items center.png" /></p>
<p>Or maybe we want them all to sit at the bottom:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636655742740/cR2ukm26J.png" alt="CSS-Flexbox-Vertical Align with align-items end.png" /></p>
<p>Note that we used the value 'end' here, but 'flex-end' still has better browser support. However, 'flex-end' is being phased out and the future is 'end'. This is because Flexbox and CSS Grid are being harmonized so that we can use the same properties in both systems, so the 'flex-' and 'grid-' prefixes are being dropped.</p>
<p>This was for aligning ALL flex-items vertically, but what if we just want to vertically align an individual flex-item? We can use <code>align-self</code> for that:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636655957907/A5_DYNAwP.png" alt="CSS-Flexbox-Vertical Align with align-self center (1).png" /></p>
<p>Or use <code>align-self: end</code> to make it sit at the bottom:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636655979326/ZDZZiw-PB.png" alt="CSS-Flexbox-Vertical Align with align-self end.png" /></p>
<p>Note that when you use <code>flex-direction: column</code>, the 'align'-properties will now work for the horizontal axis instead of the vertical axis.</p>
<p>This is the default layout when you use <code>flex-direction: column</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636656187141/TXisSzimZ.png" alt="CSS Flexbox Default Layout When using flex-direction column (2).png" /></p>
<p>Then you need to use <code>justify-content</code> to do vertical alignment for all flex-items:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636656160428/3-Ci2l2CRpO.png" alt="CSS Flexbox centering vertically when flex-direction column with justify-content center (2).png" /></p>
<p>Or for 1 individual flex-item, use 'margin' with 'auto':</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636656263268/l8HbpLPFV.png" alt="CSS Flexbox Flex direction column Align Flex item to the bottom with margin auto (1).png" /></p>
<p>The margin will now take up the space on top of the selected element, pushing itself downwards.</p>
<p>So there is no 'justify-self' property in Flexbox, because 'margin: auto' already takes care of what we want. Which is a bit confusing... I wish we had 'justify-self' in Flexbox.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
]]></content:encoded></item><item><title><![CDATA[CSS3 Flexbox: Complete Tutorial for Beginners (Examples & Illustrations)]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS3 Course.
There are 2 major options in CSS3 to implement layout...]]></description><link>https://blog.bytegrad.com/css3-flexbox-complete-tutorial-for-beginners-examples-and-illustrations</link><guid isPermaLink="true">https://blog.bytegrad.com/css3-flexbox-complete-tutorial-for-beginners-examples-and-illustrations</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 18:14:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653147210/zot36dg6u.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS3 Course</a>.</p>
<p>There are 2 major options in CSS3 to implement layouts: Flexbox &amp; CSS Grid. </p>
<p>Flexbox is the one you want to use more frequently, in my experience.</p>
<p>It all starts by setting <code>display: flex</code> on a parent element:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653156859/zKVsnQh9e.png" alt="CSS3 Flexbox Tutorial.png" /></p>
<p>This is the default layout: flex-items will be sitting on the same row next to each other.</p>
<p>Now we have 'unlocked' the Flexbox functionalities. </p>
<p>The element with <code>display: flex</code> is called the flex-container and its direct child elements are called the flex-items. </p>
<p>We can now use some Flexbox properties on both the flex-container and flex-items individually.</p>
<p>Let's say we want to center all flex-items horizontally. The <code>justify-content</code> property is used here for horizontal alignment:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653283492/NGTFsK0OfL.png" alt="CSS3 Flexbox Justify-Content Center.png" /></p>
<p>Or maybe we want it to sit at the end, horizontally:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653339882/vivmFBjXCw.png" alt="CSS3 Flexbox Justify-Content End.png" /></p>
<p>Note that you can also use 'flex-end' instead of 'end'. Flex-end still has better browser support, but the future is 'end' (the properties across Flexbox and CSS Grid are being harmonized -- i.e. the 'flex-' and 'grid-' prefixes will be removed so we have the same properties in both Flexbox &amp; CSS Grid).</p>
<p>So <code>justify-content</code> is for horizontal alignment here, now we also want to look at vertical alignment. We can use <code>align-items</code> for that:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653416703/uIf1GVhyr.png" alt="CSS3 Flexbox Justify-Content End Align items center.png" /></p>
<p>Or if we want the flex-items to be centered both horizontally and vertically:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653451212/GmcBo01qL.png" alt="CSS3 Flexbox Justify-Content Center Align items center.png" /></p>
<p>Okay, so we used justify-content for horizontal alignment and align-items for vertical alignment.</p>
<p>Important to understand about Flexbox is that you always work with 1 direction. So the flex-items will always follow 1 particular direction. The default is horizontal (row).</p>
<p>But we can also change the direction to vertical (column):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653805077/uqXs1kOlP.png" alt="CSS Flexbox Default Layout When using flex-direction column (1).png" /></p>
<p>We used <code>flex-direction: column</code> to change the direction. </p>
<p>The tricky part about this is now that <code>justify-content</code> and <code>align-items</code> flip.</p>
<p>Justify-content is now for the vertical axis and align-items for the horizontal axis.</p>
<p>Centering the flex-items vertically with <code>justify-content</code> now:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653973512/asCnOZWtE.png" alt="CSS Flexbox centering vertically when flex-direction column with justify-content center.png" /></p>
<p>And to center them horizontally too, use <code>align-items</code> now:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636654029859/NK4ZgiRNo.png" alt="CSS Flexbox centering vertically and horizontally when flex-direction column with justify-content center and align items center.png" /></p>
<p>This was all for aligning ALL flex-items, but what if we just want to position 1 flex-item in a particular way? Let's go back to the default layout in Flexbox:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636653156859/zKVsnQh9e.png" alt="CSS3 Flexbox Tutorial.png" /></p>
<p>So in the default layout, we can use 'align-items' for the vertical alignment. That's for ALL flex-items.</p>
<p>Now we want to align 1 flex-item along the vertical axis. We can do that with <code>align-self</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636654270492/MNCMU-vrF.png" alt="CSS3 Flexbox Tutorial Align-self center.png" /></p>
<p>So just select the individual flex-item and use <code>align-self</code>.</p>
<p>That's for the vertical axis. How can we align an individual flex-item along the horizontal axis? Is there a 'justify-self' property as well?</p>
<p>The answer is no. We actually have to use the <code>margin</code> property with value <code>auto</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636654384072/q_VVIR-qQ.png" alt="CSS3 Flexbox Tutorial Margin Left Auto.png" /></p>
<p>So here the margin will take up all the space to the left of the selected flex-item, pushing itself to the right.</p>
<p>Note that also for individual alignment their functionalities switch sides when you use <code>flex-direction: column</code>.</p>
<p>To create the gaps between flex-items, you can use the gap properties: <code>column-gap</code>, <code>row-gap</code> and <code>gap</code>. I didn't include it here to keep things simple, so I cheated a bit with the gap in the illustrations.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter  <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[CSS Flex Align Bottom: Examples + Illustrations]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
This is the default behavior when you first set displa...]]></description><link>https://blog.bytegrad.com/css-flex-align-bottom-examples-illustrations</link><guid isPermaLink="true">https://blog.bytegrad.com/css-flex-align-bottom-examples-illustrations</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 17:01:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636650058021/AEBtxOK-j.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>This is the default behavior when you first set <code>display: flex</code> on an element:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649226273/VC5vNjI1f.png" alt="CSS-Flex-Align-Bottom.png" /></p>
<p>How do we get all of these flex-items to align at the bottom? Well, just use <code>align-items</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649333748/GfdBXDb5G.png" alt="CSS-Flex-Align-Bottom-Align-Items-End.png" /></p>
<p>Use <code>align-content</code> if you have multiple rows (flex-items wrapping onto new rows):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649400388/z8OC_8Mnc.png" alt="CSS-Flex-Align-Bottom-Align-Content-End.png" /></p>
<p>What if we just want 1 flex-item to be aligned at the bottom? Well, just select that flex-item and use <code>align-self</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649464645/4kO-h88k0.png" alt="CSS-Flex-Align-Self-End.png" /></p>
<p>Note that the value <code>end</code> is new. It used to be called <code>flex-end</code>. Flex-end still has better support, but since Flexbox and CSS Grid are being harmonized (their values are becoming the same to simplify things) the future will be <code>end</code> in both Flexbox and CSS Grid, so without the 'flex-' or 'grid-' prefix.</p>
<p>Now, let's say we want a different direction for our flex-items, so we use <code>flex-direction: column</code>. We get this as default behavior:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649658732/khPRn2xkf.png" alt="CSS Flexbox Default Layout When using flex-direction column.png" /></p>
<p>When you use <code>flex-direction: column</code>, the functionalities of <code>align-items</code> and <code>justify-content</code> flip.</p>
<p>So we used align-items for the vertical axis, but now align-items will regulate the alignment along the horizontal axis.</p>
<p>We now need to use justify-content for alignment along the vertical axis (justify-content is for horizontal alignment in the default situation):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649844609/jNAi_WpZg.png" alt="CSS Flexbox Align to the bottom with justify-content when flex-direction is column.png" /></p>
<p>Now let's say we want to align only 1 flex-item to the bottom. We can use the 'margin: auto' feature:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649935321/8HtFgHkax.png" alt="CSS Flexbox Flex direction column Align Flex item to the bottom with margin auto.png" /></p>
<p>Margin will then simply take up the space between the selected element and the other elements, pushing the selected element to the bottom.</p>
<p>This 'margin: auto' feature is also why Flexbox doesn't have a <code>justify-self: end</code> feature: margin-auto already takes care of that, although it would have been nice to have justify-self as well -- simply for consistency.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Flex Stretch CSS: Examples + Illustrations]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
With Flexbox in the default situation (after setting d...]]></description><link>https://blog.bytegrad.com/flex-stretch-css-examples-illustrations</link><guid isPermaLink="true">https://blog.bytegrad.com/flex-stretch-css-examples-illustrations</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Thu, 11 Nov 2021 16:45:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636649017878/pdqD9fanm.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>With Flexbox in the default situation (after setting <code>display: flex</code>), you will get this layout if you have set a height on the flex-items:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636648678132/EHz580gjL.png" alt="CSS-Flexbox-Without-Stretching.png" /></p>
<p>However, if you don't set a height here, the default behavior in Flexbox is actually that the flex-items will stretch vertically:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636648755052/kvCBeLXLD.png" alt="CSS-Flexbox-With-Stretching.png" /></p>
<p>When you use <code>flex-direction: column</code>, it switches. Now, the flex-items will stretch horizontally if you don't set a <strong>width</strong>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636648933152/OhVNXsuj7.png" alt="CSS-Flexbox-With-Stretching-Flex-Direction-Column.png" /></p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[Vertical Align with Flexbox: Examples + Illustrations]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
The default layout in Flexbox is this:

The flex-items...]]></description><link>https://blog.bytegrad.com/vertical-align-with-flexbox-examples-illustrations</link><guid isPermaLink="true">https://blog.bytegrad.com/vertical-align-with-flexbox-examples-illustrations</guid><category><![CDATA[flexbox]]></category><category><![CDATA[CSS]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Wed, 10 Nov 2021 23:26:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636586789972/A3BBUDvJb.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>The default layout in Flexbox is this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636585850915/hWxP6Y9t0.png" alt="CSS-Flexbox-Default-Layout.png" /></p>
<p>The flex-items will sit along the same row, starting from the top-left corner.</p>
<p>Now, we can use <code>align-items</code> to determine where they should sit along the vertical axis.</p>
<p>This is with <code>align-items: center</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636585961451/XbyY8VGYy.png" alt="CSS Flexbox Align-Items Center.png" /></p>
<p>With <code>align-items: end</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636586080114/uI_BPQodyi.png" alt="CSS Flexbox Align-Items End.png" /></p>
<p>Note that <code>align-items: flex-end</code> still has <a target="_blank" href="https://caniuse.com/?search=align-items%20end">better support</a>. CSS Grid and Flexbox are being harmonized, meaning the values will be the same across both Flexbox and CSS Grid, so the 'flex-' prefix is getting dropped, but it will take some time before browser support for 'end' is as good as 'flex-end'.</p>
<p>Note that if you have multiple rows (after flex-items wrapping), you should use <code>align-content</code> instead of <code>align-items</code>.</p>
<p>Let's say we want all flex-items to be centered vertically, but 1 flex-item should sit at the bottom. We can use <code>align-self</code> to determine the individual vertical alignment of a flex-item:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636586362532/p86RukMr3.png" alt="CSS Flexbox Align-Self-End.png" /></p>
<p>Or use <code>align-self: start</code> to make it sit at the top:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636586398386/iJXDOIJBP.png" alt="CSS Flexbox Align-Self-start.png" /></p>
<p>If you change the <code>flex-direction</code> to <code>column</code>, things change. Now, the <code>align-items</code> and <code>align-self</code> properties will align the flex-items along the horizontal axis, instead of the vertical axis.</p>
<p>Now, the <code>justify-content</code> property will align flex-items along the vertical axis:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636586624301/cVGaYi-eD.png" alt="CSS Flexbox vertical align with justify-content_ center.png" /></p>
<p>If we want a particular flex-item to deviate from this, we can use <code>margin: auto</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636586721364/VBKIMOkKc.png" alt="CSS Flexbox vertical align with margin_ auto.png" /></p>
<p>Now margin will take up the space between the third element and other elements, pushing itself to the bottom and the other ones to the top.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[CSS Flex Column Wrap: Example + Illustration]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
The illustration is pretty self-explanatory:

Note tha...]]></description><link>https://blog.bytegrad.com/css-flex-column-wrap-example-illustration</link><guid isPermaLink="true">https://blog.bytegrad.com/css-flex-column-wrap-example-illustration</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Wed, 10 Nov 2021 22:53:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636584556766/ucznaZ2Xy.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>The illustration is pretty self-explanatory:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636584648383/lBauRnCKf.png" alt="CSS-Flexbox-Create-Multiple-Columns.png" /></p>
<p>Note that you do need to set a fixed height on the parent element (e.g. <code>height: 1150px</code>). Otherwise the flex-items won't wrap -- they will just stretch out the flex-container more and more.</p>
<p>The example uses <code>align-content</code> instead of <code>align-items</code> because we have multiple columns after wrapping the flex-items. Use <code>align-items</code> when you have just 1 column (no wrapping).</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter  <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[Flexbox with Images: Use a Wrapper Element Around Your Images]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
When you use Flexbox with a lot of images, like a gall...]]></description><link>https://blog.bytegrad.com/flexbox-with-images-use-a-wrapper-element-around-your-images</link><guid isPermaLink="true">https://blog.bytegrad.com/flexbox-with-images-use-a-wrapper-element-around-your-images</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Wed, 10 Nov 2021 22:42:57 GMT</pubDate><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>When you use Flexbox with a lot of images, like a gallery component, you might want to consider wrapping each image in a div-element. This solves a lot of issues with images in Flexbox.</p>
<p>So you get this structure:</p>
<pre><code class="lang-plaintext">&lt;div class="gallery"&gt;
  &lt;div class="gallery__item&gt;
    &lt;img class="gallery__img"&gt;
  &lt;/div&gt;
  &lt;div class="gallery__item&gt;
    &lt;img class="gallery__img"&gt;
  &lt;/div&gt;
  &lt;div class="gallery__item&gt;
    &lt;img class="gallery__img"&gt;
  &lt;/div&gt;
  &lt;div class="gallery__item&gt;
    &lt;img class="gallery__img"&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>
<pre><code class="lang-plaintext">.gallery {
  display: flex;
}

.gallery__item {

}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* best practice for sizing images in CSS -- to prevent distorted look for images */
}
</code></pre>
<p>Note that now you can't use the Flexbox functionalities on the image elements, because they are not the flex-items (their wrapper-elements are).</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item><item><title><![CDATA[Flexbox on Mobile: Responsive Layouts with Flexbox]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
Flexbox works very nicely as a layout system for respo...]]></description><link>https://blog.bytegrad.com/flexbox-on-mobile-responsive-layouts-with-flexbox</link><guid isPermaLink="true">https://blog.bytegrad.com/flexbox-on-mobile-responsive-layouts-with-flexbox</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Wed, 10 Nov 2021 22:26:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636582900861/aeu87S1M0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>Flexbox works very nicely as a layout system for responsive layouts.</p>
<p>Flex-items will automatically wrap onto new a new line if the amount of space becomes less (do set <code>flex-wrap: wrap</code>):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636582905230/5vcOu4pEj.png" alt="CSS-Flexbox-mobile (1).png" /></p>
<p>You don't even need media queries for simple layouts like this.</p>
<p>But quite often you do. In my experience, you're not gonna be able to completely get rid of media queries. </p>
<p>In fact, it's probably better to not overcomplicate things and simply code the layout with Flexbox in the way that is easy for you, then simply use media queries to adjust the layout.</p>
<p>If you use the <code>flex</code> property you can make the flex-items take up all the available space:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636583089125/hHWGPK_VYS.png" alt="CSS-Flexbox-mobile-Flex-Flex-basis.png" /></p>
<p>The <code>flex-basis</code> property acts as a minimum width here. So, first the flex-items take up 300px of width. Then, there may be some space left on the row, the so-called 'available space'. The <code>flex</code> property determines what proportion of the available space the flex-item should take up. Since they all have the same proportion ('1'), they all take up the same available space.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter  <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[CSS Columns Flex: Illustrations + Example]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
Important to understand is that you don't create colum...]]></description><link>https://blog.bytegrad.com/css-columns-flex-illustrations-example</link><guid isPermaLink="true">https://blog.bytegrad.com/css-columns-flex-illustrations-example</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Wed, 10 Nov 2021 22:04:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636581455461/7-fWjryr4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>Important to understand is that you don't create columns with Flexbox and then put elements in those columns, that's what you do with CSS Grid.</p>
<p>With Flexbox you pick a direction for the flex-items. The default is horizontal (row):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636581066622/L2Z-SMI1U.png" alt="CSS-Columns-Flex-Row.png" /></p>
<p>If you have more flex items you will get something like this if you allow them to wrap:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636581214653/TokPIyR3K.png" alt="CSS columns flex example.png" /></p>
<p>So if an additional flex-item doesn't fit on the row, it will wrap onto a new row and start from there again.</p>
<p>Now let's say that we want to create a 3-column layout here. We can do this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636581375407/rgrkVPPG3.png" alt="CSS 3-column layout with flex-basis.png" /></p>
<p>So to create a 3-column layout we simply have to make the flex-items a certain width, so that each row can contain 3 elements, and the fourth one will be kicked onto a new row.</p>
<p>Here, the <code>flex-basis</code> property acts as a minimum width. So the flex items should be at least 500px wide. After the flex-items have taken up 500px of width, there can still be some available space left on the row. </p>
<p>The <code>flex</code> property determines what proportion of this available space each element should take up. Since they all have the same proportion of '1' (since they all have the same class of 'child'), they will take up an equal amount of available space. That could be any number by the way (1 or 43 or 354325). Since they all have the same minimum width + they take up the same amount of available space, they will be the same size.</p>
<p>Note that on the last row there is more available space left, because there are only 2 elements left. But those 2 are the same size.</p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter  <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a> 
<a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a> 
<a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a> </p>
]]></content:encoded></item><item><title><![CDATA[CSS Flexbox Row: Explained (+ Example)]]></title><description><![CDATA[You need to master both Flexbox and CSS Grid in order to professionally build modern websites & web apps. If you haven't mastered both of them yet, I highly recommend going through my CSS Course.
The crucial thing to understand about Flexbox is that ...]]></description><link>https://blog.bytegrad.com/css-flexbox-row-explained-example</link><guid isPermaLink="true">https://blog.bytegrad.com/css-flexbox-row-explained-example</guid><category><![CDATA[CSS]]></category><category><![CDATA[flexbox]]></category><dc:creator><![CDATA[Wesley (ByteGrad)]]></dc:creator><pubDate>Wed, 10 Nov 2021 21:44:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1636580502427/BA8YudnHN.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You need to master both Flexbox and CSS Grid in order to professionally build modern websites &amp; web apps. If you haven't mastered both of them yet, I highly recommend going through my <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post&amp;utm_medium=blog-post&amp;utm_campaign=blog-post">CSS Course</a>.</p>
<p>The crucial thing to understand about Flexbox is that you always work with 1 direction: either the horizontal (row) or vertical (column) direction.</p>
<p>The default is the horizontal (row) direction. In CSS, that means the <code>flex-direction</code> property has a default value of <code>row</code>.</p>
<p>So what you will get as a default is this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636580527949/vUrhg_UIg.png" alt="CSS-Flexbox-Row.png" /></p>
<p>Flex items will be laid out along a row (horizontally), next to each other. Note that you don't have to set the <code>flex-direction</code> property to <code>row</code> yourself to achieve this, it's already done for you (default value).</p>
<p>If you don't want a row layout but a column layout, you can change the <code>flex-direction</code> property to <code>column</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1636580610592/X0gjeRvNV.png" alt="CSS Flexbox Row to Column with flex-direction.png" /></p>
<p>By the way, I think CSS is the 'bottleneck' to most websites &amp; web apps. I believe it's the highest-ROI skill you can master.</p>
<p>Before I mastered CSS, I lost a ton of time &amp; energy fiddling around with CSS.</p>
<p>I was learning about advanced JavaScript topics when I couldn't even implement basic layouts in CSS...</p>
<p>So I created a CSS course to help you avoid the same mistake. Check it out <a target="_blank" href="https://bytegrad.com/courses/professional-css?utm_source=blog-post-2&amp;utm_medium=blog-post-2&amp;utm_campaign=blog-post-2">here</a> if you're interested.</p>
<p>Would you like to be notified when I release a new course? You'll get early bird discounts. Sign up for my newsletter <a target="_blank" href="https://email.bytegrad.com">here</a>.</p>
<p>Also, I show projects of upcoming courses on social media, follow me here:</p>
<p><a target="_blank" href="https://www.facebook.com/ByteGrad">Facebook</a><a target="_blank" href="https://twitter.com/bytegradcom">Twitter</a><a target="_blank" href="https://www.instagram.com/bytegradcom/">Instagram</a></p>
]]></content:encoded></item></channel></rss>