<?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: Albert Chang</title>
    <description>The latest articles on DEV Community by Albert Chang (@a89529294).</description>
    <link>https://dev.to/a89529294</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%2F608731%2F7d2a80f0-57a4-42b0-9e56-b68493750485.png</url>
      <title>DEV Community: Albert Chang</title>
      <link>https://dev.to/a89529294</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/a89529294"/>
    <language>en</language>
    <item>
      <title>Mental Model For SQL Joins</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Fri, 03 Jun 2022 18:24:55 +0000</pubDate>
      <link>https://dev.to/a89529294/mental-model-for-sql-joins-431j</link>
      <guid>https://dev.to/a89529294/mental-model-for-sql-joins-431j</guid>
      <description>&lt;h2&gt;
  
  
  SYNTAX
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *  
FROM table1 
JOIN table2
    ON table1.id = table2.id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just replace JOIN with LEFT JOIN/ FULL OUTER JOIN, etc if using a different join.&lt;/p&gt;

&lt;h2&gt;
  
  
  Join / Inner Join
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;loop through each row in table1&lt;/li&gt;
&lt;li&gt;for each row in table1, loop through table2&lt;/li&gt;
&lt;li&gt;push a new row made up of all the columns in table1 and table2 into the new table if and only if table1.id === table2.id&lt;/li&gt;
&lt;li&gt;return the new table&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Left / Right Join (table1 LEFT JOIN table2)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;loop through each row in table1&lt;/li&gt;
&lt;li&gt;for each row in table1, loop through table2&lt;/li&gt;
&lt;li&gt;push a new row made up of all the columns in table1 and table2 into the new table if table1.id === table2.id&lt;/li&gt;
&lt;li&gt;If table2 has been looped through and no row has been added, add a new row with all the columns in table1 and null for all the columns in table2 to the new table.&lt;/li&gt;
&lt;li&gt;return the new table&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  FULL OUTER JOIN (table1 FULL OUTER JOIN table2)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;do a table1 LEFT JOIN table2&lt;/li&gt;
&lt;li&gt;do a table1 RIGHT JOIN table2&lt;/li&gt;
&lt;li&gt;combine the two tables returned above and remove the duplicate rows.&lt;/li&gt;
&lt;li&gt;return the combined table&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  CROSS JOIN / CARTESIAN JOIN
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;loop through each row in table1&lt;/li&gt;
&lt;li&gt;for each row in table1, loop through table2&lt;/li&gt;
&lt;li&gt;push a new row made up of all the columns in table1 and table2 into the new table&lt;/li&gt;
&lt;li&gt;return the new table&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note that CROSS JOIN is essentially JOIN without a ON clause.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>beginners</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How Babel transforms JSX to JS</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Thu, 19 May 2022 14:41:35 +0000</pubDate>
      <link>https://dev.to/a89529294/how-babel-transforms-jsx-to-js-5hg2</link>
      <guid>https://dev.to/a89529294/how-babel-transforms-jsx-to-js-5hg2</guid>
      <description>&lt;p&gt;When writing JSX you can either start your tag in lowercase &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; or in uppercase &lt;code&gt;&amp;lt;Component&amp;gt;&lt;/code&gt;. Below we will discuss each case separately&lt;/p&gt;

&lt;h2&gt;
  
  
  Lowercase tags
&lt;/h2&gt;

&lt;p&gt;Babel transforms &lt;code&gt;&amp;lt;div&amp;gt;..&lt;/code&gt; into &lt;code&gt;React.createElement('div',...)&lt;/code&gt;. Essentially treating the tag name &lt;code&gt;div&lt;/code&gt; as a string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Capitalized tags
&lt;/h2&gt;

&lt;p&gt;Babel transforms &lt;code&gt;&amp;lt;Component&amp;gt;...&lt;/code&gt; into &lt;code&gt;React.createElement(Component,...)&lt;/code&gt;. Notice the lack of quotation around &lt;code&gt;Component&lt;/code&gt; this means it will get treated as a variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  What can the variable hold?
&lt;/h2&gt;

&lt;p&gt;The first argument to &lt;code&gt;React.createElement&lt;/code&gt; can only hold strings or functions that return something that's renderable. Typically it simply holds a React component, which is a function that returns JSX. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Now we know &lt;code&gt;&amp;lt;Component&amp;gt;..&lt;/code&gt; doesn't have to reference a React component. It can also reference a simple string or any function that returns renderable content.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A Small Trick about JSX Tag Names</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Thu, 17 Mar 2022 11:46:22 +0000</pubDate>
      <link>https://dev.to/a89529294/a-small-trick-about-jsx-tag-names-4edo</link>
      <guid>https://dev.to/a89529294/a-small-trick-about-jsx-tag-names-4edo</guid>
      <description>&lt;p&gt;We all know that when writing JSX tags we need to use lowercase with native DOM elements such as &lt;code&gt;&amp;lt;div/&amp;gt;&lt;/code&gt; and we need to capitalize our custom components like this&lt;code&gt;&amp;lt;MyCustomComponent/&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What we may not understand is what goes on in the background when Babel compiles our code. When it comes to JSX Babel needs to transform it into JavaScript so the browser can understand our code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Case One - Lower Case JSX Tag
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div&amp;gt;...&amp;lt;/div&amp;gt;&lt;/code&gt; gets turned into &lt;code&gt;React.createElement('div',....);&lt;/code&gt; Babel essentially treats &lt;code&gt;div&lt;/code&gt; as a string.&lt;/p&gt;

&lt;h3&gt;
  
  
  Case Two - Capitalized JSX Tag
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;MyVariable&amp;gt;..&amp;lt;/MyVariable&amp;gt;&lt;/code&gt; gets turned into &lt;code&gt;React.createElement(MyVariable, ...)&lt;/code&gt; Note that &lt;code&gt;MyVariable&lt;/code&gt; do not need to be a React component, it is a plain old JavaScript variable! &lt;/p&gt;

&lt;h3&gt;
  
  
  CodeSandBox Example on Dynamic Wrapper
&lt;/h3&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/optimistic-mccarthy-6pcxzm"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Understanding Stacking Context and Z-index</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Tue, 15 Mar 2022 01:58:53 +0000</pubDate>
      <link>https://dev.to/a89529294/understanding-stacking-context-and-z-index-1a5m</link>
      <guid>https://dev.to/a89529294/understanding-stacking-context-and-z-index-1a5m</guid>
      <description>&lt;h2&gt;
  
  
  What are they?
&lt;/h2&gt;

&lt;p&gt;You can think of &lt;strong&gt;stacking context&lt;/strong&gt; as a container that determines how the direct* children are ordered along the z axis(positive direction pointing towards the user). &lt;strong&gt;Z-index&lt;/strong&gt; is used to change the default orders.&lt;/p&gt;

&lt;h6&gt;
  
  
  *Note that direct/first level children are from the point of view of stacking contexts not the DOM. So if we have the following structure &lt;code&gt;html -&amp;gt; div -&amp;gt; div -&amp;gt; span&lt;/code&gt;, both divs and the span are siblings as long as the divs do not create additional stacking contexts.
&lt;/h6&gt;

&lt;h2&gt;
  
  
  Why should we care?
&lt;/h2&gt;

&lt;p&gt;Usually when elements are not overlapping each other it does not matter who is actually further along the z axis. But often we have elements such as header, footer or modal that will overlap other elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  How are stacking contexts created?
&lt;/h2&gt;

&lt;p&gt;The following are the most common ways to create stacking contexts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;html&lt;/code&gt; element by default creates one.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;position:absolute;&lt;/code&gt; and &lt;code&gt;position:relative;&lt;/code&gt; with &lt;code&gt;z-index&lt;/code&gt; set to anything other than &lt;code&gt;auto&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;position:fixed;&lt;/code&gt; and &lt;code&gt;position:sticky;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;grid&lt;/code&gt; and &lt;code&gt;flex&lt;/code&gt; items with &lt;code&gt;z-index&lt;/code&gt; set to anything other than &lt;code&gt;auto&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Setting &lt;code&gt;isolation:isolate;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Setting &lt;code&gt;opacity&lt;/code&gt; to less than 1.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a full list check &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context#the_stacking_context"&gt;MDN Stacking Context&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How are direct children actually positioned in a stacking context?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;The stacking context container gets placed first.&lt;/li&gt;
&lt;li&gt;Elements with negative &lt;code&gt;z-index&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Elements with no &lt;code&gt;z-index&lt;/code&gt; or &lt;code&gt;z-index&lt;/code&gt; that is invalid on that element.&lt;/li&gt;
&lt;li&gt;Elements with &lt;code&gt;z-index:auto&lt;/code&gt;, &lt;code&gt;z-index:0&lt;/code&gt;, or positioned elements with no explicit &lt;code&gt;z-index&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Elements with positive &lt;code&gt;z-index&lt;/code&gt;;&lt;/li&gt;
&lt;/ol&gt;

&lt;h6&gt;
  
  
  &lt;code&gt;z-index&lt;/code&gt; is only valid on positioned elements and flex/grid items.
&lt;/h6&gt;

&lt;h6&gt;
  
  
  Elements within the same category are ordered following the DOM order.
&lt;/h6&gt;

&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;p&gt;Note unless otherwise specified, the elements do not create stacking contexts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;html(default stacking context)

&lt;ul&gt;
&lt;li&gt;div1

&lt;ul&gt;
&lt;li&gt;div2&lt;/li&gt;
&lt;li&gt;div3&lt;/li&gt;
&lt;li&gt;div4 

&lt;ul&gt;
&lt;li&gt;span&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this situation, &lt;code&gt;div1, div2, div3, div4, span&lt;/code&gt; are all direct children of the stacking context created by &lt;code&gt;html&lt;/code&gt;. So they are all category 3 elements from above section and will be ordered following the DOM order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;html(default stacking context)

&lt;ul&gt;
&lt;li&gt;div1

&lt;ul&gt;
&lt;li&gt;div2(position:relative; z-index:1;)

&lt;ul&gt;
&lt;li&gt;div3(position:absolute; z-index:9999;)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;div4(position:relative; z-index:2;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this situation, we have 4 stacking contexts. Since only 2 of them, &lt;code&gt;html&lt;/code&gt; and &lt;code&gt;div2&lt;/code&gt; have children we don't need to worry about the other 2. &lt;br&gt;
From the pov of the &lt;code&gt;html&lt;/code&gt; stacking context, it has three direct children, &lt;code&gt;div1&lt;/code&gt;, &lt;code&gt;div2&lt;/code&gt;, and &lt;code&gt;div4&lt;/code&gt;, and their order along the z axis is the same. This means that despite &lt;code&gt;div3&lt;/code&gt; having a high &lt;code&gt;z-index&lt;/code&gt; it will be below &lt;code&gt;div4&lt;/code&gt; since it is contained within a parent(&lt;code&gt;div2&lt;/code&gt;) that is rendered below &lt;code&gt;div4&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Understanding how &lt;code&gt;z-index&lt;/code&gt; and how it orders elements along the z axis is all about understanding what stacking context the elements are in and knowing that you can only compare direct children with each other in a stacking context.&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CSS Position Property</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Sun, 13 Mar 2022 02:47:51 +0000</pubDate>
      <link>https://dev.to/a89529294/css-position-property-1p2j</link>
      <guid>https://dev.to/a89529294/css-position-property-1p2j</guid>
      <description>&lt;h2&gt;
  
  
  What does this property do?
&lt;/h2&gt;

&lt;p&gt;It determines how an element is positioned in the document.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some Clarifications
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;offset properties&lt;/em&gt; refers to top/right/bottom/left properties&lt;/li&gt;
&lt;li&gt;an element's &lt;em&gt;natural position&lt;/em&gt; / where an element would &lt;em&gt;naturally be&lt;/em&gt; refers to the element without position property defined on it&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;positioned element&lt;/em&gt; refers to an element with display set to anything other than static&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  All CSS Position Values
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;position:static; (default)&lt;/li&gt;
&lt;li&gt;position:relative;&lt;/li&gt;
&lt;li&gt;position:absolute;&lt;/li&gt;
&lt;li&gt;position:fixed;&lt;/li&gt;
&lt;li&gt;position:sticky;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  static
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;The default value.&lt;/li&gt;
&lt;li&gt;Cannot use offset properties.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  relative
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Allows use of offset properties.&lt;/li&gt;
&lt;li&gt;The offset properties are based on where the element would naturally be.&lt;/li&gt;
&lt;li&gt;The elements around it will treat this element as if it still sits in its natural position regardless if offset properties are used.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  absolute
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Allows use of offset properties.&lt;/li&gt;
&lt;li&gt;The offset properties are based on the closest non-static ancestor or the initial viewport. This means that if the body is scrollable the absolute element will not move with the viewport.&lt;/li&gt;
&lt;li&gt;Elements around it will treat it as if it doesn't exit.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  fixed
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Allows use of offset properties.&lt;/li&gt;
&lt;li&gt;The offset properties are based on the viewport(not the initial viewport) or if any ancestor has transform, perspective or filter set to anything other than none.&lt;/li&gt;
&lt;li&gt;Elements around it will treat it as if it doesn't exit.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  sticky
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Allows use of offset properties.&lt;/li&gt;
&lt;li&gt;The offset properties are based on nearest ancestor with overflow set to anything other than visible. If it cannot find one, it uses &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;, check using &lt;code&gt;document.scrollingElement&lt;/code&gt;. Another way to think of offset values is it is the minimum gap between the element and the edge of the viewport while the container is in-frame.&lt;/li&gt;
&lt;li&gt;The element is also constrained by its closest block level ancestor. i.e. it cannot leave that ancestor.&lt;/li&gt;
&lt;li&gt;The elements around it will treat this element as if it still sits in its natural position regardless if offset properties are used.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Positioned elements all allow the use of offset properties.&lt;/li&gt;
&lt;li&gt;Elements around static, relative, sticky elements will treat them as if they are still in their natural positions.&lt;/li&gt;
&lt;li&gt;Elements around absolute and fixed elements will treat them as if they don't exist.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>css</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>html</category>
    </item>
    <item>
      <title>Bite-Sized CSS: Pseudo Classes vs. Pseudo Elements</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Thu, 26 Aug 2021 15:54:11 +0000</pubDate>
      <link>https://dev.to/a89529294/bite-sized-css-pseudo-classes-vs-pseudo-elements-1fmf</link>
      <guid>https://dev.to/a89529294/bite-sized-css-pseudo-classes-vs-pseudo-elements-1fmf</guid>
      <description>&lt;h2&gt;
  
  
  Pseudo Classes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Starts with one colon.&lt;/li&gt;
&lt;li&gt;Deals with states, such as button:hover, button:focus.&lt;/li&gt;
&lt;li&gt;Selects the whole element.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes"&gt;MDN Pseudo Classes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pseudo Elements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Starts with double colons, ::before, ::first-letter, etc.&lt;/li&gt;
&lt;li&gt;Selects part of the element.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements"&gt;MDN Pseudo Elements&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>beginners</category>
      <category>html</category>
    </item>
    <item>
      <title>Block vs. Inline vs. Inline-Block</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Tue, 17 Aug 2021 06:36:59 +0000</pubDate>
      <link>https://dev.to/a89529294/block-vs-inline-vs-inline-block-55j4</link>
      <guid>https://dev.to/a89529294/block-vs-inline-vs-inline-block-55j4</guid>
      <description>&lt;h3&gt;
  
  
  Block
&lt;/h3&gt;

&lt;p&gt;elements with &lt;code&gt;display: block;&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It occupies the entire horizontal space of its parent element.&lt;/li&gt;
&lt;li&gt;Always start on a new line.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most elements by default belongs to this category. For a complete list please refer to &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#elements"&gt;MDN list of block elements&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Inline
&lt;/h3&gt;

&lt;p&gt;elements with &lt;code&gt;display: inline;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does not start on a new line.&lt;/li&gt;
&lt;li&gt;Its width and height are determined by the content.&lt;/li&gt;
&lt;li&gt;Not affected by width, height, margin-top, margin-bottom properties.&lt;/li&gt;
&lt;li&gt;Affected by horizontal padding and margin.&lt;/li&gt;
&lt;li&gt;Affected by padding-top and padding-bottom, but only visually. Other elements will not respect the vertical paddings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/a89529294/embed/zYwQPdQ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;For a complete list of inline elements &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements#elements"&gt;MDN list of inline elements&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Inline-block
&lt;/h3&gt;

&lt;p&gt;elements with &lt;code&gt;display: inline-block&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An inline element that respects margin, width and height.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>css</category>
      <category>beginners</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Practical Introduction to CSS Grid</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Mon, 16 Aug 2021 10:09:51 +0000</pubDate>
      <link>https://dev.to/a89529294/practical-introduction-to-css-grid-22go</link>
      <guid>https://dev.to/a89529294/practical-introduction-to-css-grid-22go</guid>
      <description>&lt;h3&gt;
  
  
  What is CSS Grid
&lt;/h3&gt;

&lt;p&gt;A two dimensional system made up of rows and columns that helps you position your html elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to enable and use CSS Grid
&lt;/h3&gt;

&lt;p&gt;On any element, declare &lt;code&gt;display:grid ;&lt;/code&gt;&lt;br&gt;
Every item that is added to that element will by default occupy a row.&lt;br&gt;
So if I add five divs to the grid, you will see five rows created and occupied by the divs.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to modify default behaviour of the grid container element
&lt;/h3&gt;

&lt;p&gt;If you want to create a 3x2 (3 rows x 2 columns) grid then this is what you need to declare on the grid element:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;display:grid;
grid-template-rows: 1fr 1fr 1fr;
grid-template-columns: 1fr 1fr;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: There are many other units you can use here in place of fr, like px, %, and many more. Fr units means the remaining space so in this example all the rows have the same height and all the columns have the same width.&lt;/p&gt;

&lt;h3&gt;
  
  
  How the items position themselves in a grid container
&lt;/h3&gt;

&lt;p&gt;By default, items flow from left to right, top to bottom. So continuing last section's example, the 1st item will occupy the top left cell, the 2nd item will occupy the top center cell and so on, until the first row is filled up. Then the items will move down to the next row. &lt;br&gt;
Note: This is the default behaviour which can be changed by specifying &lt;code&gt;grid-auto-flow: column&lt;/code&gt;, then the items will flow from top to bottom then left to right.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to position a specific element into a certain cell
&lt;/h3&gt;

&lt;p&gt;Say we have a 3x3 grid. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e8NvYX35--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e9v7imr256vylvlur4b2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e8NvYX35--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e9v7imr256vylvlur4b2.png" alt="grid_lines"&gt;&lt;/a&gt;&lt;br&gt;
If we want to position an element with class &lt;code&gt;item&lt;/code&gt; into the center cell we have to declare&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;grid-area: row-start/ col-start/ row-end/ col-end;&lt;br&gt;
Here the row-start etc, refer to the lines.&lt;/p&gt;

&lt;h6&gt;
  
  
  There are many different ways to define a grid and to position items on a grid. This only serves as a very basic starting point so you can start using grids in your projects.
&lt;/h6&gt;

</description>
      <category>css</category>
      <category>beginners</category>
      <category>html</category>
    </item>
    <item>
      <title>Super Short Introduction to Rem &amp; Em</title>
      <dc:creator>Albert Chang</dc:creator>
      <pubDate>Sat, 07 Aug 2021 23:09:23 +0000</pubDate>
      <link>https://dev.to/a89529294/super-short-introduction-to-rem-em-1f65</link>
      <guid>https://dev.to/a89529294/super-short-introduction-to-rem-em-1f65</guid>
      <description>&lt;h2&gt;
  
  
  Rem
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Root element's font size&lt;/strong&gt;. In other words, it is the font size of the html element. &lt;br&gt;
If no font size is specified on the html element, it is determined by the browser's font size setting which has a default of 16px.&lt;/p&gt;

&lt;h2&gt;
  
  
  Em
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Current element's font size&lt;/strong&gt;. For example, let's say you have a button with a font size of 20px. If you define the padding to be 2em, the size of the padding will be 40px. &lt;/p&gt;

</description>
      <category>css</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
