<?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: Richard Terungwa Kombol</title>
    <description>The latest articles on DEV Community by Richard Terungwa Kombol (@rkterungwa16).</description>
    <link>https://dev.to/rkterungwa16</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%2F57363%2F0a82c8b1-94c6-4b23-8998-cfedf1b80c73.jpeg</url>
      <title>DEV Community: Richard Terungwa Kombol</title>
      <link>https://dev.to/rkterungwa16</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rkterungwa16"/>
    <language>en</language>
    <item>
      <title>Notes on ES modules and CommonJS module systems: What you may or may not know about them.</title>
      <dc:creator>Richard Terungwa Kombol</dc:creator>
      <pubDate>Thu, 14 Dec 2023 21:19:20 +0000</pubDate>
      <link>https://dev.to/rkterungwa16/notes-on-es-modules-and-commonjs-module-systems-what-you-may-or-may-not-know-about-them-mmb</link>
      <guid>https://dev.to/rkterungwa16/notes-on-es-modules-and-commonjs-module-systems-what-you-may-or-may-not-know-about-them-mmb</guid>
      <description>&lt;p&gt;A module is a standalone software component implementing specific functionalities and is easily reusable in different applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A module can depend on the functionality provided by another module.&lt;/li&gt;
&lt;li&gt;A module exports its functionality for other modules to consume.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Within a module, values that are not explicitly exported are private within the module and cannot be accessed by client modules.&lt;/p&gt;

&lt;p&gt;Modules have become very critical in building modern and complex JavaScript applications as they help make code organization in large applications easier to reason about.&lt;/p&gt;

&lt;p&gt;JavaScript module systems are standards that define how to write JavaScript modules.&lt;/p&gt;

&lt;p&gt;Example module systems include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CommonJS&lt;/li&gt;
&lt;li&gt;ES modules&lt;/li&gt;
&lt;li&gt;AMD (Asynchronous Module Definition)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One defining feature of all module systems is that they define how dependencies are loaded into a module that depends on it.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;CommonJS&lt;/strong&gt; module system has a built-in mechanism to load modules. The &lt;code&gt;require&lt;/code&gt; statement triggers this mechanism.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;ES module&lt;/strong&gt; system has a built-in mechanism to load modules. The &lt;code&gt;import&lt;/code&gt; statement triggers this mechanism.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;AMD&lt;/strong&gt; system makes use of a range of loaders that must be AMD-compatible.&lt;br&gt;
Some of these AMD-compatible loaders include LABjs, Steal.js, yepnope.js, $script.js, bdLoad, and RequireJS.&lt;/p&gt;

&lt;p&gt;The process of loading dependencies into a JavaScript module involves:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;fetching the JavaScript code from where it is located (OS file system for Node.js, remote server for browsers). This process is the loading phase.&lt;/li&gt;
&lt;li&gt;Instantiating the loaded modules.&lt;/li&gt;
&lt;li&gt;Evaluating or executing the modules.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The process of instantiating and evaluating modules is synchronous even for ES modules.&lt;/p&gt;

&lt;p&gt;It is the process of fetching and loading the modules that could be asynchronous and synchronous depending on the environment.&lt;/p&gt;

&lt;p&gt;The different environments have their implementation of the module loaders which are responsible for fetching these files/modules.&lt;/p&gt;

&lt;p&gt;The ES module specification says how you should parse files into module records, and how you should instantiate and evaluate that module. However, it doesn’t say how to get the files in the first place.&lt;/p&gt;

&lt;p&gt;For browsers, the HTML specification defines how the module loaders should be implemented.&lt;/p&gt;

&lt;p&gt;For server environments like Node.js, and because OS file system calls don’t take that long compared to calls over the internet, the process of fetching and loading modules is synchronous.&lt;/p&gt;

&lt;p&gt;For browser environments, where modules are fetched over the internet, and networks are generally slower and less predictable than OS file operations, the loading phase is asynchronous to prevent any piece of JavaScript code from delaying the browser's main thread.&lt;/p&gt;

&lt;p&gt;In the ES module system, the phase responsible for loading a file is called the construction phase.&lt;/p&gt;

&lt;p&gt;The construction phase has 3 steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Figure out where to download the file containing the module from (aka module resolution)&lt;/li&gt;
&lt;li&gt;Fetch the file (by downloading it from a URL or loading it from the file system)&lt;/li&gt;
&lt;li&gt;Parse the file into a module record&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Module loading for CommonJS modules is synchronous because the dependencies below it are loaded, instantiated, and evaluated simultaneously, without any breaks in between.&lt;/p&gt;

&lt;p&gt;The synchronous constraint for CommonJS modules expects that the module will not produce side effects.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;module.exports&lt;/code&gt; are not expected to have side effects and thus cannot be set asynchronously.&lt;/p&gt;

&lt;p&gt;The synchronous constraint CommonJS demands is the primary reason for synchronous APIs that can be used for initialization tasks.&lt;/p&gt;

&lt;p&gt;Note that synchronous means the task blocks on the main thread, and must finish before the next task can be executed. Thus, these sync APIs used for initialization are blocking.&lt;/p&gt;

&lt;p&gt;ES modules however do not have this constraint. A module can have side effects like making network connections etc.&lt;/p&gt;

&lt;p&gt;Because ES modules can be async is the primary reason why the CommonJS module cannot be used to load an ES module as a dependency. But ES modules can load CommonJS modules.&lt;/p&gt;

&lt;p&gt;If you want to load modules that can have side effects in a CommonJS module, there is a &lt;strong&gt;Dynamic import&lt;/strong&gt; method that can help with this.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Dynamic import&lt;/strong&gt; method is a key component in code-splitting and lazy loading of JavaScript on demand. This is possible because of the asynchronous nature. The JavaScript code will only be available when it is needed and will not be bundled upfront with other parts that are actually needed.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Node.js Morsel for today: creating symbolic links to your packages locally using `npm link`</title>
      <dc:creator>Richard Terungwa Kombol</dc:creator>
      <pubDate>Mon, 24 Jul 2023 13:07:39 +0000</pubDate>
      <link>https://dev.to/rkterungwa16/nodejs-morsel-for-today-creating-symbolic-links-to-your-packages-locally-using-npm-link-409c</link>
      <guid>https://dev.to/rkterungwa16/nodejs-morsel-for-today-creating-symbolic-links-to-your-packages-locally-using-npm-link-409c</guid>
      <description>&lt;h2&gt;
  
  
  What is a symbolic link?
&lt;/h2&gt;

&lt;p&gt;Symbolic links are operating system operations that facilitate the creation of shortcuts to files or folders. The shortcuts help the user access the folder in places other than the original file location.&lt;/p&gt;

&lt;p&gt;Node.js package managers provide the &lt;code&gt;link&lt;/code&gt; command to help developers access the folder as packages locally as they would when published on the registry or from git.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create a symbolic link with an npm link?
&lt;/h2&gt;

&lt;p&gt;As stated before, &lt;code&gt;npm&lt;/code&gt; has a command called a &lt;code&gt;link&lt;/code&gt;. For example, I have a project called &lt;code&gt;@terk/color-utils&lt;/code&gt;, a library package, but I want to test this package on other projects locally before publishing it on the npm registry. The npm &lt;code&gt;link&lt;/code&gt; helps with this.&lt;/p&gt;

&lt;p&gt;Start with running the command &lt;code&gt;npm link&lt;/code&gt; in the root of the &lt;code&gt;@terk/color-utils&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q8MBCUJN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4ob7j6a03gvwlkswzme.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q8MBCUJN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4ob7j6a03gvwlkswzme.png" alt="screenshot to show how the command looks in the package" width="800" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This command with no arguments will create a symbolic link in the global &lt;code&gt;node_modules&lt;/code&gt; folder &lt;code&gt;.nvm/versions/node/v18.16.0/lib/node_modules/@terk/color-utils&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Something to note is that the folder name in the global node_module is the name on the package.json name property.&lt;/p&gt;

&lt;p&gt;Verify that the link was created using &lt;code&gt;npm ls -g&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tZWhb6----/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15krtgz2osmug3f12nfh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tZWhb6----/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15krtgz2osmug3f12nfh.png" alt="screenshot to verify that a symlink has been created" width="800" height="65"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then proceed to the project that intends to use the package and run the command npm link &lt;code&gt;@terk/color-utils&lt;/code&gt; in the project root folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7LI3Wf7c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fthgcxpz6krwjuabhe6f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7LI3Wf7c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fthgcxpz6krwjuabhe6f.png" alt="screenshot to show how the linked package is installed in an application" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This action installs the package from the global node_module into the project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2dnwPCrC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4cuo6ub9tbtv6pkhco8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2dnwPCrC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4cuo6ub9tbtv6pkhco8.png" alt="screenshot to show the installed package in the node_module" width="432" height="1014"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>npm</category>
      <category>symlink</category>
    </item>
    <item>
      <title>Node.js morsel for today: Understanding Node.js timers</title>
      <dc:creator>Richard Terungwa Kombol</dc:creator>
      <pubDate>Tue, 18 Jul 2023 18:56:16 +0000</pubDate>
      <link>https://dev.to/rkterungwa16/nodejs-morsel-for-today-understanding-nodejs-timers-4c8e</link>
      <guid>https://dev.to/rkterungwa16/nodejs-morsel-for-today-understanding-nodejs-timers-4c8e</guid>
      <description>&lt;p&gt;From the Node.js documentation, Node.js &lt;code&gt;Timers&lt;/code&gt; are described as scheduling functions to be called at some future period of time.&lt;/p&gt;

&lt;p&gt;Broadly, they refer to the &lt;code&gt;setTimeout&lt;/code&gt;, &lt;code&gt;setInterval&lt;/code&gt; and &lt;code&gt;setImmediate&lt;/code&gt; functions. They are further broken into subgroups defined by the phase of the event loop their handle callbacks are executed.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are &lt;code&gt;Handle&lt;/code&gt; callbacks?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://docs.libuv.org/en/v1.x/design.html#handles-and-requests"&gt;Handles represent long-lived objects capable of performing certain operations while active&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Invoking a timer creates a &lt;code&gt;ref’ed&lt;/code&gt; handle by default. A &lt;code&gt;ref’ed&lt;/code&gt; handle is an active handle with the callback not yet executed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;immediateHandle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;setImmediate&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SetImmediate Handle Callback&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// Log immediateHandle gives us the handle object&lt;/span&gt;
&lt;span class="c1"&gt;// Immediate {&lt;/span&gt;
&lt;span class="c1"&gt;//   _idleNext: null,&lt;/span&gt;
&lt;span class="c1"&gt;//   _idlePrev: null,&lt;/span&gt;
&lt;span class="c1"&gt;//   _onImmediate: [Function (anonymous)],&lt;/span&gt;
&lt;span class="c1"&gt;//   _argv: undefined,&lt;/span&gt;
&lt;span class="c1"&gt;//   _destroyed: false,&lt;/span&gt;
&lt;span class="c1"&gt;//   [Symbol(refed)]: true,&lt;/span&gt;
&lt;span class="c1"&gt;//   [Symbol(asyncId)]: 2,&lt;/span&gt;
&lt;span class="c1"&gt;//   [Symbol(triggerId)]: 1&lt;/span&gt;
&lt;span class="c1"&gt;// }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;immediateHandle&lt;/code&gt; logged out in the code snippet shows 2 properties that are important to the &lt;code&gt;Event Loop&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;_onImmediate&lt;/code&gt;: this is the callback that will be invoked. &lt;code&gt;setTimeout&lt;/code&gt; has &lt;code&gt;_onTimeout&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Symbol(refed)&lt;/code&gt;: this shows that the handle is active. It becomes &lt;code&gt;null&lt;/code&gt; when not active.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;timers&lt;/code&gt; &lt;code&gt;Event Loop&lt;/code&gt; phase is where the callbacks of the handles created by the &lt;code&gt;setTimeout&lt;/code&gt; and &lt;code&gt;setInterval&lt;/code&gt; functions are called.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;check&lt;/code&gt; &lt;code&gt;Event Loop&lt;/code&gt; phase is where the callbacks of the handles created by the &lt;code&gt;setImmediate&lt;/code&gt; functions are called.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;_onImmediate&lt;/code&gt; callback is invoked on the next iteration of the &lt;code&gt;Event Loop&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;_onTimeout&lt;/code&gt; callback is invoked when the current &lt;code&gt;Event Loop's&lt;/code&gt; iteration concept of &lt;code&gt;now&lt;/code&gt; is ahead of the scheduled time based on the &lt;code&gt;setTimeout&lt;/code&gt; threshold.&lt;/p&gt;

</description>
      <category>node</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>eventloop</category>
    </item>
    <item>
      <title>CSS morsel for today: understanding CSS initial values using the unset keyword</title>
      <dc:creator>Richard Terungwa Kombol</dc:creator>
      <pubDate>Tue, 18 Jul 2023 18:54:55 +0000</pubDate>
      <link>https://dev.to/rkterungwa16/css-morsel-for-today-understanding-css-initial-values-using-the-unset-keyword-15d5</link>
      <guid>https://dev.to/rkterungwa16/css-morsel-for-today-understanding-css-initial-values-using-the-unset-keyword-15d5</guid>
      <description>&lt;p&gt;From its description in the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/unset"&gt;MDN&lt;/a&gt; docs, the &lt;code&gt;unset&lt;/code&gt; CSS keyword is described as a way to reset a CSS property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.&lt;/p&gt;

&lt;p&gt;To understand what this means, say, in a contrived scenario, we are using a CSS media query to render a CSS class that behaves differently on mobile and desktop screens.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.Socials__wrapper--mobile&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3.4375rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fffdf9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The snippet above is meant to run on mobile screens. It is also the default styling for the class &lt;code&gt;Socials__wrapper--mobile&lt;/code&gt;. But we want the &lt;code&gt;Socials__wrapper--mobile&lt;/code&gt; to behave differently on desktop screens. We do not want certain property values to carry over to desktop styling. On the desktop, we don't want &lt;code&gt;bottom&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt;, &lt;code&gt;height&lt;/code&gt;, or &lt;code&gt;width&lt;/code&gt; to be defined. We do this by setting these properties to &lt;code&gt;unset&lt;/code&gt; in the media query as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1024px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* This should run on tablets and desktops.  */&lt;/span&gt;
  &lt;span class="nc"&gt;.Socials__wrapper--mobile&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;unset&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;unset&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;unset&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;unset&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fffdf9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the properties &lt;code&gt;bottom&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, and &lt;code&gt;height&lt;/code&gt; is referred to as &lt;code&gt;non-inherited&lt;/code&gt; properties. This means that they don't automatically inherit their values from the encapsulating parent element like say a &lt;code&gt;color&lt;/code&gt; property would. And because of this, assigning &lt;code&gt;unset&lt;/code&gt; to them means the browser (also referred to as the user agent) assigns the default values defined in the CSS specifications to the properties.&lt;/p&gt;

&lt;p&gt;The initial value for the &lt;code&gt;box-model&lt;/code&gt; (width, height) and &lt;code&gt;position&lt;/code&gt; (top, bottom, etc) properties as defined in the specification is &lt;code&gt;auto&lt;/code&gt;. If we replace the &lt;code&gt;unset&lt;/code&gt; keyword with &lt;code&gt;auto&lt;/code&gt; we get the same effect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1024px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* This should run on tablets and desktops.  */&lt;/span&gt;
  &lt;span class="nc"&gt;.Socials__wrapper--mobile&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fffdf9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is important that &lt;code&gt;auto&lt;/code&gt; is the keyword to signify that the browser (user agent) needs to compute this property automatically taking into consideration the context and content. The context could be the behaviour of the parent element.&lt;/p&gt;

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