<?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>Forem: Victor Ikechukwu</title>
    <description>The latest articles on Forem by Victor Ikechukwu (@iamvictor).</description>
    <link>https://forem.com/iamvictor</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%2F600265%2F1c8769f3-7931-4d66-b1c1-6ca00f0d5d44.jpeg</url>
      <title>Forem: Victor Ikechukwu</title>
      <link>https://forem.com/iamvictor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/iamvictor"/>
    <language>en</language>
    <item>
      <title>A Very, Very In-Depth Guide on CSS Grid</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Wed, 14 Dec 2022 06:42:59 +0000</pubDate>
      <link>https://forem.com/coderpad/a-very-very-in-depth-guide-on-css-grid-23p5</link>
      <guid>https://forem.com/coderpad/a-very-very-in-depth-guide-on-css-grid-23p5</guid>
      <description>&lt;p&gt;As websites progressed from simple documents into complex, interactive applications, web developers have utilized multiple approaches to organize and control the layout of UI elements on a webpage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From floating elements around the webpage with the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/float" rel="noopener noreferrer"&gt;CSS float property&lt;/a&gt; to &lt;/li&gt;
&lt;li&gt;Inserting elements into an &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table" rel="noopener noreferrer"&gt;HTML table element&lt;/a&gt; to create a table-based layout&lt;/li&gt;
&lt;li&gt;Positioning elements &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/position" rel="noopener noreferrer"&gt;using the position property&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;And, more recently, using the &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox" rel="noopener noreferrer"&gt;Flexible box layout (Flexbox)&lt;/a&gt; to align content on the page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While these techniques enable us to organize and control the layout of elements on a webpage, they are not always sustainable, as some lead to performance bottlenecks. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Floats affect a web page's SEO. &lt;/li&gt;
&lt;li&gt;Table-based layouts lead to non-semantic markup on our sites, compromising &lt;a href="https://coderpad.io/blog/development/introduction-to-web-accessibility-a11y/" rel="noopener noreferrer"&gt;accessibility&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Positioning elements require using CSS hacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Enter CSS Grid.&lt;/p&gt;

&lt;p&gt;CSS Grid is a layout system—a method of organizing elements on a webpage—used for building two-dimensional layouts. It is a structure made up of intersecting horizontal and vertical lines known as grid lines that divide the layout of an HTML element into rows and columns.&lt;/p&gt;

&lt;p&gt;CSS Grid is a powerful tool that enables web developers to define the position of HTML elements and control how the elements would span horizontally and vertically across the page—a feat that cannot be achieved using other layout systems.&lt;/p&gt;

&lt;p&gt;This article is a comprehensive guide for everything you need to know about the CSS Grid layout system. &lt;/p&gt;

&lt;p&gt;In this article, we'll go over:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The CSS Grid vocabulary&lt;/li&gt;
&lt;li&gt;How to make a basic grid&lt;/li&gt;
&lt;li&gt;Inserting gutters between grid elements&lt;/li&gt;
&lt;li&gt;What CSS Grid and Flexbox have in common&lt;/li&gt;
&lt;li&gt;Aligning grid items horizontally &lt;/li&gt;
&lt;li&gt;Aligning grid items vertically &lt;/li&gt;
&lt;li&gt;Measurement units introduced with the CSS Grid layout&lt;/li&gt;
&lt;li&gt;Useful CSS functions you should utilize when working with CSS Grid&lt;/li&gt;
&lt;li&gt;Expanding grid items across multiple grid lines&lt;/li&gt;
&lt;li&gt;Syntax to shorten the amount of CSS you need to type&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  The CSS Grid vocabulary
&lt;/h1&gt;

&lt;p&gt;CSS Grid introduces a few new concepts you should familiarize yourself with before diving into its usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grid container&lt;/strong&gt;: The HTML element on which the grid layout is applied.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxwx7wppd1imaxbyhiq91.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxwx7wppd1imaxbyhiq91.jpg" alt="A grid container is what holds the grid itself. If the grid constructs a box, then the container makes up the corners of the box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid container is what holds the grid itself. If the grid constructs a box, then the container makes up the corners of the box.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Grid item(s)&lt;/strong&gt;: All direct child elements of the grid container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grid line&lt;/strong&gt;: These are the horizontal and vertical dividing lines that make up the structure of the grid. These lines reside on either side of a column (column grid lines) or row (row grid lines). Hence, a grid with four columns will have five column lines, with one after the last column.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6bdhbhyhv77syjygs4o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6bdhbhyhv77syjygs4o.png" alt="Grid lines"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Grid lines are the horizontal and vertical dividers (lines) that seperate grid items into a grid&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Grid cell&lt;/strong&gt;: The space between two column grid lines and two adjacent row grid lines, also known as grid tracks. It is a single unit of a grid and the smallest unit possible. By default, all grid items are laid out one item per grid cell.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2yy0qig79ecgg21701l6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2yy0qig79ecgg21701l6.png" alt="grid cell"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid cell is the space between adjacent grid lines. Think of them as smaller boxes that construct the larger grid system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Grid track&lt;/strong&gt;: The area between two adjacent grid lines. The gap between two grid row lines is a row track, and the gap between two grid column lines is a column track. The size of a grid track determines the width and height of our grid items.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcv8048t0l6t374o36v8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcv8048t0l6t374o36v8.png" alt="grid track"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid track is the area between two adjacent grid lines. Horizontal grid tracks are known as rows, and vertical grid tracks are known as columns.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Grid area&lt;/strong&gt;: A rectangular area on the grid made up of one or more grid cells. Grid areas are created when a grid item spans over one-to-many grid tracks. They must be rectangular; creating a T- or L-shaped grid area is impossible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2y485ewx8ovsnk89a54r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2y485ewx8ovsnk89a54r.png" alt="grid area"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid area is a rectangular area on the grid and can consist of something as small as one cell, or as big as the entire grid&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, without further ado, let's dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  How to make a basic grid
&lt;/h2&gt;

&lt;p&gt;To create a CSS Grid layout, you'll first need to define a grid container. The grid container can be any individual parent element (for example, a div).&lt;/p&gt;

&lt;p&gt;To define a grid container, pass the &lt;code&gt;display&lt;/code&gt; property with either a value of &lt;code&gt;grid&lt;/code&gt; or &lt;code&gt;inline-grid&lt;/code&gt; to an element's style block. Doing this will implicitly convert all direct child elements of the grid container into grid items.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.block-level-grid-container {
display: grid;
}

.inline-level-grid-container {
display: inline-grid;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The value &lt;code&gt;grid&lt;/code&gt; makes the parent grid element act a bit like an unstyled &lt;code&gt;div&lt;/code&gt;, making it span the full width of a page by default due to them being block-level elements. In contrast, the value &lt;code&gt;inline-grid&lt;/code&gt; behaves much like an unstyled &lt;code&gt;span&lt;/code&gt;, making it act like an inline element to its siblings.&lt;/p&gt;

&lt;p&gt;Let's look at an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="box a"&amp;gt;1&amp;lt;/div&amp;gt;
        &amp;lt;div class="box b"&amp;gt;2&amp;lt;/div&amp;gt;
        &amp;lt;div class="box c"&amp;gt;3&amp;lt;/div&amp;gt;
        &amp;lt;div class="box d"&amp;gt;4&amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code block above, we define a &lt;code&gt;div&lt;/code&gt; with a class of &lt;code&gt;"container"&lt;/code&gt;. Within the &lt;code&gt;div&lt;/code&gt; are four child elements.&lt;/p&gt;

&lt;p&gt;We can now set the &lt;code&gt;div&lt;/code&gt; as a grid container.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi9jg4av9o5yz9pzh2zbu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi9jg4av9o5yz9pzh2zbu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The four elements are stacked on top of one-another vertically&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Setting an element to a grid container alone will not immediately affect how the child elements are displayed, as we still haven't specified how the layout should look. Hence, CSS lays out the grid items in a single-column grid.&lt;/p&gt;

&lt;p&gt;To change the layout of the grid items within a grid, we must explicitly define the rows and columns we want our grid to have. To do that, we'll use the CSS properties &lt;code&gt;grid-template-columns&lt;/code&gt; and &lt;code&gt;grid-template-rows&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Grid Template Columns
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;grid-template-columns&lt;/code&gt; property lets us specify the number of columns we want in a grid container and how wide each column should be.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;grid-template-columns&lt;/code&gt; property accepts one or more non-negative CSS length unit values. The number of CSS-length values passed to the property specifies how many columns our grid container will have, and each value represents how wide each column (i.e., each grid track) would be.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: grid;
  grid-template-columns: 400px 400px 400px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptwt01b94yq66skiqg79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptwt01b94yq66skiqg79.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Because there are three columns, with four items, there will be two rows. The top row will have 1, 2, and 3 split into thirds, each 400px wide. The bottom row will have a 400px wide 4 element.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the example above, we use the grid-template-columns property to change the layout of our grid container to be divided into three columns, each &lt;code&gt;400px&lt;/code&gt; wide.&lt;/p&gt;

&lt;p&gt;Notice that the last grid item starts on a new row below the first three columns. That is because we only specified three columns that are each &lt;code&gt;400px&lt;/code&gt; wide. Consequently, when the number of grid items in the grid container exceeds three, CSS will wrap other grid items into new rows to maintain the container's layout.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that we can't assign negative values to the CSS properties associated with the grid layout. Passing a value such as&lt;code&gt;-400px&lt;/code&gt; to the grid-template-columns property will not affect the structure of a grid.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Grid Template Rows
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;grid-template-rows property&lt;/code&gt; lets us specify the height of each row in a grid container.&lt;/p&gt;

&lt;p&gt;Unlike the &lt;code&gt;grid-template-columns&lt;/code&gt; property, it doesn't specify the number of rows our grid container should have. It only sets the height of each row. Such behavior occurs because a grid container will implicitly create a new row whenever grid items wrap into new lines. Hence, we can't control the number of rows that should be present in a grid using the &lt;code&gt;grid-template-rows&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;grid-template-rows&lt;/code&gt; property accepts one or more non-negative CSS length values where each value represents the height of each row in a grid container, from the first to the last.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: grid;
  grid-template-columns: 400px 400px 400px;
  grid-template-rows: 100px 200px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, values of &lt;code&gt;100px&lt;/code&gt; and &lt;code&gt;200px&lt;/code&gt; are passed to the grid-template-rows property. This gives the first row in the grid container a height of &lt;code&gt;100px&lt;/code&gt; and the second row a height of &lt;code&gt;200px&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1bxw7inh9bxdo22qqnt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1bxw7inh9bxdo22qqnt.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Four elements with numbers inside of them are divided into a grid. There are two rows in this grid; the first is 100px tall, while the second is 200px high.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the code above, the &lt;code&gt;grid-template-rows&lt;/code&gt; property sets only the heights of the first two rows in the grid container. If we are to add more grid items to the grid container and it creates new rows to wrap them onto, the heights of these implicitly created rows will not be determined by the &lt;code&gt;grid-template-rows&lt;/code&gt; property but by the size of their content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr9m2yzloybzenwpmmr4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr9m2yzloybzenwpmmr4p.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid that contains twelve items and is split into three columns will create four rows. The first row is 100px high, the second is 200px, and the third and fourth are only as tall as the element's contents.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Adding a gap between rows and columns
&lt;/h3&gt;

&lt;p&gt;Adding more rows and columns to a grid container without properly spacing them apart would make the grid look too jam-packed and not helpful as a layout system. We can add gutters (spacing) between columns and rows to space them apart by adjusting the size of our grid lines. Let's explore how we can do that.&lt;/p&gt;

&lt;h4&gt;
  
  
  column-gap
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;column-gap&lt;/code&gt; property adds some spacing between columns by adjusting the width of the vertical grid lines in a grid container. It accepts a non-negative CSS length value which defines how broad the grid line between each column will be.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
display: grid; 
column-gap: 28px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above sets the width of every vertical (column) grid line in the grid container to &lt;code&gt;28px&lt;/code&gt;. This adds a space of &lt;code&gt;28px&lt;/code&gt; between every column in the grid.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42jqfoqln3kht4er8xzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42jqfoqln3kht4er8xzj.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With three columns inside of a grid, there is now a 28 pixels gap to separate each column within the grid. The rows do not have a gap, as one has not yet been specified.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  row-gap
&lt;/h4&gt;

&lt;p&gt;Just like &lt;code&gt;column-gap&lt;/code&gt;, the &lt;code&gt;row-gap&lt;/code&gt; property adds some spacing between rows in a grid container by adjusting the height of all horizontal grid lines in a grid container. It accepts a non-negative CSS length value which defines how large the grid line between each row will be.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
display: grid; 
column-row: 40px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above sets the height of every horizontal (row) grid line in the grid container to &lt;code&gt;40px&lt;/code&gt;. This adds a distance of &lt;code&gt;40px&lt;/code&gt; between every row in the grid.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwcm1y0cfy75igq2rouwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwcm1y0cfy75igq2rouwb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There are two rows in this column, with a 40px gap between them&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We can combine the &lt;code&gt;column-gap&lt;/code&gt; and &lt;code&gt;row-gap&lt;/code&gt; properties to space our columns and rows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
display: grid; 
column-gap: 20px;
   row-gap: 20px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzzg601u2u3a1yjaz12m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzzg601u2u3a1yjaz12m.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with rows and columns and a 20px of spacing between cells specified with the aforementioned CSS&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using just a few lines of CSS, we have created a grid layout with all the basic CSS Grid properties such as columns, rows, and gutters.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does CSS Grid have in common with Flexbox?
&lt;/h2&gt;

&lt;p&gt;The Flexible box layout, commonly referred to as Flexbox, is a one-dimensional layout system that excels in allocating space between elements and aligning content on a webpage. It shares some similar features and characteristics with the CSS Grid layout, such as implementing the Box Alignment Level 3 specification for aligning flex items, the same standard CSS Grid uses for aligning grid items in a grid container. You can learn more about the Flexbox layout here.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to align content horizontally
&lt;/h2&gt;

&lt;p&gt;CSS Grid exposes six properties that let us control the alignment of grid items along the &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Grid_Axis" rel="noopener noreferrer"&gt;rows (inline axis) or columns (block axis)&lt;/a&gt; of a grid container. In this section, we'll go over each property that aligns grid items horizontally along the columns of the grid container.&lt;/p&gt;

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

&lt;p&gt;The &lt;code&gt;justify-items&lt;/code&gt; property controls the alignment of all grid items along a grid container's inline (column) axis. It is passed to the grid container, and its value applies to all grid items within the grid. It accepts four possible values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;start&lt;/strong&gt; — aligns grid items to the beginning of all columns, which is the left edge of their cell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
justify-items: start;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffo28bhgli6wbte7xfx2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffo28bhgli6wbte7xfx2m.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Items in the container are aligned to the left of the cell&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;end&lt;/strong&gt; — aligns grid items to the end of all columns, which is the right edge of their cell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
justify-items: end;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F555tllm8a3d8ogjmtod4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F555tllm8a3d8ogjmtod4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Items in the container are aligned to the right of the cell&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;center&lt;/strong&gt; — places all grid items at the center of their cells.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
justify-items: center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5715du108pgy6519yr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5715du108pgy6519yr6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Items in the container are aligned to the center of the cell, with space on both sides&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;stretch&lt;/strong&gt; — will stretch out the grid items to fill the whole width of their cells: this is the default value of the justify-items property.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
justify-items: stretch;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2sjcm1f33v1owt6ptwr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2sjcm1f33v1owt6ptwr.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Items in the container take up the entire space of the cell&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;The &lt;code&gt;justify-content&lt;/code&gt; property lets you set the horizontal alignment of the entire grid within the inline (row) axis of the grid container. It accepts seven possible values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;start&lt;/strong&gt; — aligns the entire grid to the left edge of the grid container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
justify-content: start; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsf67djf3tjvtr3rh3mnl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsf67djf3tjvtr3rh3mnl.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;end&lt;/strong&gt; — aligns the entire grid to the right edge of the grid container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
justify-content: end; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xqcavknm0yigw88132v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xqcavknm0yigw88132v.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;center&lt;/strong&gt; — places the entire grid horizontally at the center of the grid container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
justify-content: center; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwx25v23d4f1h391f54lu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwx25v23d4f1h391f54lu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;stretch&lt;/strong&gt; — resizes the grid items to allow the grid to fill the entire width of the grid container: this is the default value of the justify-content property.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
justify-content: stretch; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8d8cnoyctlg47asae18.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8d8cnoyctlg47asae18.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;space-around&lt;/strong&gt; — adds an even amount of space between each grid item, with half-sized spaces on both ends of the grid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
justify-content: space-around; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fha4961nzw7li5btk0a3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fha4961nzw7li5btk0a3r.png" alt="Image description"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;space-between&lt;/strong&gt; — creates an even amount of space between each grid item, with no space at the ends of the grid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
justify-content: space-between; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxaiiej00ao4pohrfgkr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxaiiej00ao4pohrfgkr.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;space-evenly&lt;/strong&gt; — puts an even amount of space between each grid item and on both ends of the grid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
justify-content: space-evenly; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fww7e2jva5z4wb43fmj1l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fww7e2jva5z4wb43fmj1l.png" alt="Image description"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  justify-self
&lt;/h3&gt;

&lt;p&gt;This behavior of the &lt;code&gt;justify-items&lt;/code&gt; property that controls the alignment of grid items along the inline (row) axis of a grid container can also be set on individual grid items via the &lt;code&gt;justify-self&lt;/code&gt; property. This property is passed to the grid items. It accepts four possible values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;start&lt;/strong&gt; — aligns a grid item to the beginning of a column, which is the left edge of its cell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-1 {
justify-self: start;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0rqty41sfmhpq1e36zx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0rqty41sfmhpq1e36zx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The first item in the grid is aligned to the left of the cell space, while all of the other items stretch to fill the cell area.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;end&lt;/strong&gt; — aligns the grid item to the end of a column, which is the right edge of its cell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-2 {
justify-self: end;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjkl4l20h3c19oso96ymc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjkl4l20h3c19oso96ymc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The second item in the grid is aligned to the right of the cell space, while all of the other items stretch to fill the cell area.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;center&lt;/strong&gt; — places the grid item at the center of its cell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-3 {
justify-self: center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3n0taz81402lrr0vz9k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3n0taz81402lrr0vz9k.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The third item in the grid is aligned to the center of the cell space, while all of the other items stretch to fill the cell area.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;stretch&lt;/strong&gt; — will stretch out the grid item to fill the entire cell width; this is the default value of the &lt;code&gt;justify-self&lt;/code&gt; property.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-1 {
justify-self: stretch;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbj34u7i6u3kra28a41dy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbj34u7i6u3kra28a41dy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The first grid item, like all grid items in the grid, is stretched to take up the full horizontal space of the grid cell.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How to align content vertically
&lt;/h2&gt;

&lt;p&gt;Now let's look at the properties that align grid items vertically along the rows of the grid container.&lt;/p&gt;

&lt;h3&gt;
  
  
  align-items
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;align-items&lt;/code&gt; property controls the alignment of all grid items along a grid container's block (column) axis. It is passed to the grid container, and its value applies to all grid items within the grid. It accepts four possible values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;start&lt;/strong&gt; — places all grid items at the top of all rows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
align-items: start;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F95t4epeteqj8zczt17nm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F95t4epeteqj8zczt17nm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The items in the grid are aligned to the top of the cell space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;end&lt;/strong&gt; — places all grid items at the bottom of all rows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
align-items: end;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fub2f7o8qzdks4lnstmzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fub2f7o8qzdks4lnstmzh.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The items in the grid are aligned to the bottom of the cell space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;center&lt;/strong&gt; — places all grid items at the center of their cells.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
align-items: center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdrxzvuf6x75czj7f8plt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdrxzvuf6x75czj7f8plt.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The items in the grid are aligned to the vertical center of the cell space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;stretch&lt;/strong&gt; — will stretch out all grid items to fill the entire height of their cells; this is the default value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
align-items: stretch;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bnooksgrt689av6nen8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bnooksgrt689av6nen8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The items in the grid are stretched to take up the full vertical space of the cell space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  align-content
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;align-content&lt;/code&gt; property lets you set the vertical alignment of the entire grid within the block (column) axis of the grid container. It accepts seven possible values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;start&lt;/strong&gt; — aligns the entire grid to the top of the grid container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
align-content: start; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fccl25uqcya1u0aex9m75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fccl25uqcya1u0aex9m75.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Captured with the help of: &lt;a href="https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center" rel="noopener noreferrer"&gt;https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;end&lt;/strong&gt; — aligns the entire grid to the bottom of the grid container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
align-content: end; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcvizf9xd3g3kq7e35ut.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcvizf9xd3g3kq7e35ut.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Captured with help of: &lt;a href="https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center" rel="noopener noreferrer"&gt;https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;center&lt;/strong&gt; — places the entire grid vertically at the center of the grid container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
align-content: center; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fygm9sillxpmx5wx9436x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fygm9sillxpmx5wx9436x.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Captured with help of: &lt;a href="https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center" rel="noopener noreferrer"&gt;https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;stretch&lt;/strong&gt; — The grid items stretch to fill the full height of the container grid; this is the default value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
align-content: stretch; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n18aa01qqyukd15lx8v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n18aa01qqyukd15lx8v.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Captured with help of: &lt;a href="https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center" rel="noopener noreferrer"&gt;https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;space-around&lt;/strong&gt; — creates an even amount of space between each grid item, with half-sized spaces on both ends of the grid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
align-content: space-around; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftyhcglx48v70af0buw9k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftyhcglx48v70af0buw9k.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Captured with help of: &lt;a href="https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center" rel="noopener noreferrer"&gt;https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;space-between&lt;/strong&gt; — adds an even amount of space between each grid item, with no space at the ends of the grid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
align-content: space-between; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcnkk6psp54wvn5bnhke.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcnkk6psp54wvn5bnhke.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Captured with help of: &lt;a href="https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center" rel="noopener noreferrer"&gt;https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;space-evenly&lt;/strong&gt; — places an even amount of space between each grid item and on both ends of the grid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
align-content: space-evenly; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhez9as05i5w5ly5qx17w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhez9as05i5w5ly5qx17w.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Captured with help of: &lt;a href="https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center" rel="noopener noreferrer"&gt;https://www.w3schools.com/css/tryit.asp?filename=trycss_grid_align-content_center&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  align-self
&lt;/h3&gt;

&lt;p&gt;This behavior of the &lt;code&gt;align-items&lt;/code&gt; property that controls the alignment of grid items along the block (column) axis of a grid container can also be set on individual grid items via the &lt;code&gt;align-self&lt;/code&gt; property. This property is passed to the grid items. It accepts four possible values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;start&lt;/strong&gt; — places a grid item at the top of its cell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-4 {
align-self: start;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugl26bw57xypiaze5ny9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugl26bw57xypiaze5ny9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The fourth item in the grid is aligned to the top of the cell space, while all of the other items stretch to fill the cell area.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;end&lt;/strong&gt; — places a grid item at the bottom of its cell.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-5 {
align-self: end;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe57q9ob4e19kqatzphy4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe57q9ob4e19kqatzphy4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The fifth item in the grid is aligned to the bottom of the cell space, while all of the other items stretch to fill the cell area.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;center&lt;/strong&gt; — places a grid item at the center of its cells.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-6 {
align-self: center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwklvizzpd45m8fmmsmad.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwklvizzpd45m8fmmsmad.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The sixth item in the grid is aligned to the vertical center of the cell space, while all of the other items stretch to fill the cell area.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;stretch&lt;/strong&gt; — will stretch out the grid item to fill the entire height of its cell; this is the default value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.box-1 {
align-self: stretch;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11rc57yins4eusf5i3s8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11rc57yins4eusf5i3s8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The first grid item, like all grid items in the grid, is stretched to take up the full vertical space of the grid cell.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introducing new measurement units
&lt;/h2&gt;

&lt;p&gt;Aside from non-negative CSS length values such as &lt;code&gt;px&lt;/code&gt;, &lt;code&gt;rem&lt;/code&gt;, &lt;code&gt;vw&lt;/code&gt;, and percentages (%), you can also use special sizing units and keywords to control the size of grid items in a grid. &lt;/p&gt;

&lt;h3&gt;
  
  
  The fractional (fr) unit
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;fr&lt;/code&gt; unit, short for "fractional," is a length unit introduced with the CSS Grid layout. It represents a fraction of the free space available in a grid container. This makes it the ideal unit for defining responsive columns and rows that will scale as the browser's viewport shrinks and grows.&lt;/p&gt;

&lt;p&gt;Let's look at an example to explain how helpful the &lt;code&gt;fr&lt;/code&gt; unit is and why it's a better alternative to other CSS length units.&lt;/p&gt;

&lt;p&gt;Say we are to create a grid layout made up of three columns where the first column takes up 1/6 of the grid's width, the second column takes up twice the width of the first column, and the third column takes up three times the width of the first column.&lt;/p&gt;

&lt;p&gt;If we weren't using the &lt;code&gt;fr&lt;/code&gt; unit in the example above, we'd have to perform some math on our end. We had to figure out the total width of the grid (100%), divide that by 6, then multiply whatever the result is by how wide each column should span, which would be.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;width of first column = 100% / 6 * 1 ---&amp;gt; 15%
width of second column = 100% / 6 * 2 ---&amp;gt; 30%
width of third column = 100% / 6 * 3 ---&amp;gt; 45%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As the layout becomes more complex, using percentages or any CSS math function becomes unsustainable. This is when the &lt;code&gt;fr&lt;/code&gt; unit comes in handy.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;fr&lt;/code&gt; unit tidies all this by letting us specify how the available space in a grid container should be distributed among its rows and columns. Then it spreads the space available in that order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
display: grid;
grid-template-columns: 1fr 2fr 3fr;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, we assign a fraction of the available space in a grid container to the first column, then twice to the second column, and thrice to the third column.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcj9bo9830inbiqe14z2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjcj9bo9830inbiqe14z2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid that consists of three columns and two rows. The first column is one-third the size of the last column and half the size of the second column.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  min-content
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;min-content&lt;/code&gt; is a sizing keyword that sets the width of a grid track to its intrinsic minimum width, which is usually the size of the smallest content or text within its grid items. It works similarly to the CSS function &lt;code&gt;min&lt;/code&gt;, but is used as a spacing unit instead of a function.&lt;/p&gt;

&lt;p&gt;When applied to a column or row, they become as narrow as the longest word in their track. This lets you get the shortest measurement of the content inside the grid items.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
display: grid;
grid-template-columns: 1fr min-content 1fr;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, we set the first and third columns to be as wide as a fraction of the grid container while passing the &lt;code&gt;min-content&lt;/code&gt; to the second column, making it shrink to the size of the words in its grid items.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3kke4kcalfzro5aafiz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3kke4kcalfzro5aafiz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with three columns. The middle column only takes up the smallest amount of space needed to display a single character, while the first and last columns take up all remaining space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  max-content
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;max-content&lt;/code&gt; sizing keyword has the opposite effect of &lt;code&gt;min-content&lt;/code&gt;;&lt;code&gt;max-content&lt;/code&gt; behaves similarly to a CSS function: &lt;code&gt;max()&lt;/code&gt;. When applied to either a column or row, the track becomes as wide as possible for all the content within the grid items to display in one long unbroken line. &lt;/p&gt;

&lt;p&gt;The most significant benefit of using &lt;code&gt;max-content&lt;/code&gt; is that you can let the content within our grid items breathe and spread out rather than wrapping them into new lines, which causes vertical text overflows.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
display: grid;
grid-template-columns: 1fr max-content 1fr;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above defines three columns and sets the width of the second column to the &lt;code&gt;max-content&lt;/code&gt; keyword. If we add a lot of words to the grid items in the second column, the text in these grid items won't overflow. Instead, the width of the second column will grow, and the first and third columns will shrink to accommodate it.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx2n6uvjrdmbpon1s3cjf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx2n6uvjrdmbpon1s3cjf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with three columns. The middle column has a sentence that's not broken into newlines, but rather stretches to fill as much space as it needs and no more. The first and last columns take up all remaining space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Useful CSS functions to combine with CSS Grid
&lt;/h2&gt;

&lt;p&gt;When working with the CSS Grid layout, there are a few handy functions you should familiarize yourself with to help increase the efficiency of your CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  repeat()
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;repeat()&lt;/code&gt; function lets us define recurring unit declarations for our grid container's rows or columns in a more compact form.&lt;/p&gt;

&lt;p&gt;For example, suppose you repeat unit declarations when defining columns or rows using the &lt;code&gt;grid-template-rows&lt;/code&gt; and &lt;code&gt;grid-template-column&lt;/code&gt; properties. You can use the &lt;code&gt;repeat()&lt;/code&gt; function to declare these recurring patterns more concisely.&lt;/p&gt;

&lt;p&gt;The function takes two arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;repeat count&lt;/strong&gt;: this is an integer value of 1 or higher, or the keyword values auto-fill or auto-fit. It specifies the number of times the recurring pattern of the rows or columns should repeat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;track(s) definition&lt;/strong&gt;: this is where we specify the recurring pattern of rows or columns to repeat. We can pass one or more non-negative length values to it, where each value represents the size of a row or column.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Essentially, its syntax is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;repeat(&amp;lt;number of columns/rows&amp;gt;, &amp;lt;the height or width of each column /row&amp;gt;);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Say we want to create a grid with six equal columns. Without the &lt;code&gt;repeat()&lt;/code&gt; function, we'd have to explicitly define each column using the grid-template-columns property.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;However, as the number of columns increases, this approach becomes unsustainable and verbose. We can rewrite this into a more compact form using the &lt;code&gt;repeat()&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
display: grid;
grid-template-columns: repeat(6, 1fr);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we use the &lt;code&gt;repeat()&lt;/code&gt; function to create a column that spans over a fraction of our grid container, repeating the process six times. This drastically reduces the number of repetitive unit declarations in our CSS.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fah94cabcpqcaoapg2iwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fah94cabcpqcaoapg2iwn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Six evenly spaced items in a row&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  minmax()
&lt;/h3&gt;

&lt;p&gt;When defining a responsive grid layout, you likely want to give each grid track a minimum and maximum size to ensure that they scale up and down to fit their content as the viewport resizes. This is where the &lt;code&gt;minmax()&lt;/code&gt; property comes in handy.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;minmax()&lt;/code&gt; function lets us specify a minimum and maximum size for a grid track. As the grid is resized across viewports, the grid track will grow and shrink across that range. On smaller screens, it will shrink until it reaches the minimum size. And on larger screens, it will stretch until it reaches the maximum size.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;minmax()&lt;/code&gt; function takes two parameters, &lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;, where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;min is the minimum size of the track.&lt;/li&gt;
&lt;li&gt;max is the maximum size of the track.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minmax(&amp;lt;minimum allowed value&amp;gt;, &amp;lt;maximum value&amp;gt;);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;minmax()&lt;/code&gt; function also accepts CSS Grid sizing units, keywords, length and percentage values.&lt;/p&gt;

&lt;p&gt;Let's look at an example using the &lt;code&gt;minmax()&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, minmax(100px, max-content));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, we use the &lt;code&gt;minmax()&lt;/code&gt; function to set the minimum height of the two rows in our grid container to 100px and the maximum height to &lt;code&gt;max-content&lt;/code&gt;, which ensures each row stretches and becomes as wide as possible to contain its contents if it gets taller than &lt;code&gt;100px&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkd48m0wl27wyhu7lqcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkd48m0wl27wyhu7lqcd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Two rows and three columns. The three columns have equidistant widths. The first row has 100px height, and the second has the height of a paragraph inside one of the cells.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A significant benefit of the &lt;code&gt;minmax()&lt;/code&gt; function is that it reduces the need for media queries. Rather than relying mainly on media queries to control the size of grid tracks (columns and rows) across viewports, it lets you set up, to a degree, a responsive transition of values for a grid track.&lt;/p&gt;

&lt;h3&gt;
  
  
  fit-content()
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;fit-content()&lt;/code&gt; function operates similarly to the &lt;code&gt;minmax()&lt;/code&gt; function. The difference is that with &lt;code&gt;fit-content()&lt;/code&gt;, the minimum value is the size of the content within the grid item, and the maximum value would be the value we pass to it. This lets you clamp your content to the smallest value and scale it up to a certain value as needed.&lt;/p&gt;

&lt;p&gt;When applied to a grid track, it sets the size of the grid track to its intrinsic minimum width, which is the size of the smallest piece of content or text in its grid items. The caveat is that the smallest piece of content or text size is not larger than the value specified in the function. &lt;/p&gt;

&lt;p&gt;However, if the value of the intrinsic minimum width exceeds the value supplied to the function, the size of the grid track is set to the value passed to the &lt;code&gt;fit-content()&lt;/code&gt; function, and the content of the grid items will begin to wrap.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;.container {&lt;br&gt;
display: grid;&lt;br&gt;
grid-template-columns: fit-content(200px) fit-content(300px) fit-content(400px);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;The code above creates three columns with widths of 200px, 300px, and 400px, respectively, using the &lt;code&gt;fit-content()&lt;/code&gt; function. This means that the size of each column will be equal to the size of the smallest piece of content or text in its grid items, but if that becomes greater than the value supplied to the &lt;code&gt;fit-content()&lt;/code&gt; function, then the size of the columns will be set to the value passed to the &lt;code&gt;fit-content()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0nam4yqj4xbawf636qfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0nam4yqj4xbawf636qfi.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with three columns. The first and third columns are only as wide as a single character, since that's what they contain. The middle column is 300px wide because there's a paragraph in the middle of it&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Expanding grid items across multiple grid lines
&lt;/h2&gt;

&lt;p&gt;Remember, when talking about grid lines, the horizontal lines reside on either side of a row (known as row grid lines), and the vertical lines reside on either side of a column (known as column grid lines) within the grid container.&lt;/p&gt;

&lt;p&gt;In the grid container, each grid line is given a number based on its position on the grid. The first grid line (row or column) is given the number 1, the second 2, and so on. &lt;/p&gt;

&lt;p&gt;For example, the image below displays the number of grid lines present on a grid container with three columns and two rows, where the column lines are the numbers inside the orange circle from 1 - 4, while the row lines are the ones inside the blue circle from 1 - 3.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid system with the lines numbered as described previously&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The browser uses these grid lines to control the layout and position of items within the grid. For instance, in the image above, the first column spans from column line 1 to column line 2, and the first grid item will be placed between those lines and span that wide. However, a handful of CSS Grid properties let us control the position of grid items along these grid lines and how wide they would span horizontally and vertically across them.&lt;/p&gt;

&lt;p&gt;The properties you can use to control the position of grid items and how they span across these lines are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;grid-column-start&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;grid-column-end&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;grid-row-start&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;grid-row-end&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's go over each in detail.&lt;/p&gt;
&lt;h3&gt;
  
  
  grid-column-start
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;grid-column-start&lt;/code&gt; CSS property lets us specify the horizontal starting position of a grid item along the column grid lines within the grid container. This start position defines the start of the left edge of the grid item.&lt;/p&gt;

&lt;p&gt;Using the grid layout below, let's target the first grid item and set its horizontal starting position to column line 2.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2u0hk3agc3wamgotbpov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2u0hk3agc3wamgotbpov.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with two rows and three columns with each cell area numbered. The first row is "1, 2, 3," and the second row is "4, 5, 6"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We can target the &lt;code&gt;div&lt;/code&gt; using CSS pseudo-selectors, or you can apply classes to the element and target it with that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container div:nth-of-type(1) {
  grid-column-start: 2;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Doing this, the horizontal starting position of the selected grid item will be on the second vertical grid line (column line 2).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5csnn9kirkgluaj2up4g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5csnn9kirkgluaj2up4g.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with three rows and three columns, and six items. The first item in the grid starts on the second column, which shifts every numbered cell item to the right by 1, overflowing to the left.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From the image above, the first grid item now begins at column line 2, while the other grid items are pushed over, wrapping onto new rows or creating empty spaces on the grid.&lt;/p&gt;

&lt;h3&gt;
  
  
  grid-column-end
&lt;/h3&gt;

&lt;p&gt;Along with specifying the horizontal starting position of a grid item with &lt;code&gt;grid-column-start&lt;/code&gt;, we can set where the grid item should end using the &lt;code&gt;grid-column-end&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container div:nth-of-type(1) {
  grid-column-start: 2;
  grid-column-end: 4;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the first grid item start on column line 2, span across two grid lines, and end on line 4. Using the &lt;code&gt;grid-column-start&lt;/code&gt; and &lt;code&gt;grid-column-end&lt;/code&gt; properties, we can effectively control the horizontal starting position of a grid item and how wide it spans across the grid.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyk0khvz3zdlpu4n7o62g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyk0khvz3zdlpu4n7o62g.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with three rows and three columns, and six items. The first item in the grid starts on the second column and spans into the third column, which shifts every numbered cell item to the right by 2, overflowing to the left.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  grid-row-start
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;grid-row-start&lt;/code&gt; property lets us specify the vertical starting position of a grid item along the horizontal (row) grid lines within the grid container. This sets the line where the grid item begins.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container div:nth-of-type(2) {
  grid-row-start: 1;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, we set the vertical starting position of the second &lt;code&gt;div&lt;/code&gt; element to row line 1 using the &lt;code&gt;grid-row-start&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzia1kwu3mgbjio70pn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzia1kwu3mgbjio70pn8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with three rows and three columns and six items. The order of the items is: "2, 1", "3, 4, 5", then "6" on each row, respectively&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  grid-row-end
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;code&gt;grid-row-end&lt;/code&gt; property lets us specify the vertical ending position of a grid item along the horizontal (row) grid lines within the grid container.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container div:nth-of-type(2) {
    grid-row-start: 1;
    grid-row-start: 4;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the second grid item start on the first-row line and span down three grid lines, ending on line 4. Using the &lt;code&gt;grid-row-start&lt;/code&gt; and &lt;code&gt;grid-row-end&lt;/code&gt; properties, we can effectively control the vertical starting position of a grid item and its height down the grid.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v4c9bvheb141ekj57hn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v4c9bvheb141ekj57hn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A grid with three rows and columns. The first item starts on the second column and stretches to the third column on the first row. The second item starts on the first row and stretches to the third row on the first column. The last four items make up a two-by-two square in the bottom left corner.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  CSS Grid shorthands
&lt;/h2&gt;

&lt;p&gt;Like most CSS properties, CSS Grid offers a handful of shorthand properties that provide a shorter and more forward way to set the values of multiple CSS Grid properties simultaneously. Using these shorthand properties, we can write more concise (and often, more readable) style sheets, saving time and energy.&lt;/p&gt;

&lt;p&gt;Let's take a look at these properties.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using a single CSS rule to set all gutters in a grid
&lt;/h3&gt;

&lt;p&gt;In this guide, we have seen how we can add gutters (spacing) between columns and rows to space them apart using the &lt;code&gt;column-gap&lt;/code&gt; and &lt;code&gt;row-gap&lt;/code&gt; grid properties. Using a single property — &lt;code&gt;gap&lt;/code&gt;, we can set the values for both the &lt;code&gt;column-gap&lt;/code&gt; and &lt;code&gt;row-gap&lt;/code&gt; properties.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;gap&lt;/code&gt; property is a shorthand for the row-gap and column-gap properties. It lets us add gutters (spacing) between columns and rows.&lt;/p&gt;

&lt;p&gt;Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gap: &amp;lt;row-gap&amp;gt; &amp;lt;column-gap&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The gap property accepts two values where:&lt;br&gt;
:&lt;br&gt;
&lt;code&gt;&amp;lt;row-gap&amp;gt;&lt;/code&gt; is the first value passed to the gap property. It sets the value of the &lt;code&gt;row-gap&lt;/code&gt; property.&lt;br&gt;
&lt;code&gt;&amp;lt;column-gap&amp;gt;&lt;/code&gt; is the second value passed to the gap property and sets the value of the column-gap property. It is an optional value, and if omitted, it's set to the same value as &lt;code&gt;&amp;lt;row-gap&amp;gt;&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    display: grid;
    gap: 20px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds a space of &lt;code&gt;20px&lt;/code&gt; between all columns and rows in a grid container and is the same as the code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
    display: grid; 
    column-row: 20px;
    row-gap: 20px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Combining horizontal and vertical alignments into single CSS rules
&lt;/h3&gt;

&lt;p&gt;We talked about the six CSS Grid properties that let us control the alignment of grid items along the rows (incline axis) and columns (block axis) of a grid container. In this section, we'll go over the shorthand properties that let us set the alignment of grid items much better.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;place-items&lt;/code&gt; is a shorthand property that lets us set the values for the &lt;code&gt;align-items&lt;/code&gt; and &lt;code&gt;justify-items&lt;/code&gt; properties in a single declaration. It allows us to control the alignment of all grid items horizontally and vertically at once.&lt;/p&gt;

&lt;p&gt;It accepts two values: the first value sets the value of the align-items property, and the second sets that of the justify-items property. If the second value is not specified, the first value will be assigned as the value of both properties.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
    display: grid; 
    place-items: center; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sets the value of both the &lt;code&gt;align-items&lt;/code&gt; and &lt;code&gt;justify-items&lt;/code&gt; properties to &lt;code&gt;center,&lt;/code&gt; placing all grid items at the center of their grid areas.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;place-content&lt;/code&gt; is a shorthand property that lets us set the values for the grid properties &lt;code&gt;align-content&lt;/code&gt; and &lt;code&gt;justify-content&lt;/code&gt; in a single declaration—enabling us to control the horizontal and vertical alignment of the entire grid within the grid container at once.&lt;/p&gt;

&lt;p&gt;It accepts two values: the first value sets the value of the &lt;code&gt;align-content&lt;/code&gt; property, and the second sets that of the &lt;code&gt;justify-content&lt;/code&gt; property. If the second value is not specified, the first value will be assigned as the value of both properties.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container { 
    display: grid; 
    place-content: center; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sets the value of both the &lt;code&gt;align-content&lt;/code&gt; and &lt;code&gt;justify-content&lt;/code&gt; properties to &lt;code&gt;center,&lt;/code&gt; centering the entire grid within the grid container horizontally and vertically.&lt;/p&gt;

&lt;h4&gt;
  
  
  place-self
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;place-items&lt;/code&gt; is a shorthand property that lets us set the values for the &lt;code&gt;align-self&lt;/code&gt; and &lt;code&gt;justify-self&lt;/code&gt; properties in a single declaration. It enables you to control an individual grid item's horizontal and vertical alignment within its grid area.&lt;/p&gt;

&lt;p&gt;It accepts two values: the first value sets the value of the &lt;code&gt;align-self&lt;/code&gt; property, and the second sets that of the &lt;code&gt;justify-self&lt;/code&gt; property. If the second value is not specified, the first value will be assigned as the value of both properties.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.item { 
place-self: end center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, the value of the &lt;code&gt;align-self&lt;/code&gt; property is set to 'end,' which pushes the grid item vertically down to the bottom of its grid cell. And the &lt;code&gt;justify-self&lt;/code&gt; property is set to 'center,' which places the grid item horizontally at the center of its cell.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7mqolgnlejedythifth.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7mqolgnlejedythifth.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The first grid item in the grid is aligned to the vertical end of the cell space and horizontally at the center, while all of the other items stretch to fill the cell area&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Shortening the CSS for spanning grid items across columns and rows
&lt;/h3&gt;

&lt;p&gt;Declaring the 'grid-column-start,' 'grid-column-end,' 'grid-row-start,' and 'grid-row-end' attributes anytime you want to span a grid item across some columns and rows can be somewhat redundant. Let's look at some shorthand properties that can help us declare the CSS to span grid items more concisely.&lt;/p&gt;

&lt;h4&gt;
  
  
  grid-column
&lt;/h4&gt;

&lt;p&gt;The grid-column is a shorthand property for the &lt;code&gt;grid-column-start&lt;/code&gt; and &lt;code&gt;grid-column-end&lt;/code&gt; properties. It lets us specify the horizontal starting position of a grid item along the column grid lines within the grid container and where the grid item should end.&lt;/p&gt;

&lt;p&gt;Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grid-column: column-start / column-end;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The grid-column property accepts two grid line values separated by a slash (/) where:&lt;/p&gt;

&lt;p&gt;The first value, &lt;code&gt;column-start,&lt;/code&gt; is the value of the &lt;code&gt;grid-column-start&lt;/code&gt; property.&lt;br&gt;
The second value after the slash, &lt;code&gt;column-end,&lt;/code&gt; is the value of the &lt;code&gt;grid-column-end&lt;/code&gt; property.&lt;br&gt;
And the slash (/) serves as a demarcator between these two values as both can contain one or more whitespaces. As a result, passing the slash is required to eliminate errors and ambiguity. Also, as a best practice, adding some whitespace at both sides of the slash (/) is recommended to make our CSS more readable.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.gird-item {
  grid-column: 1 / 4;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above tells the grid item to span horizontally from column line 1 to column line 4 in the grid.&lt;/p&gt;

&lt;h4&gt;
  
  
  grid-row
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;grid-row&lt;/code&gt; property works just like the &lt;code&gt;grid-column&lt;/code&gt; property. It is a shorthand property for the &lt;code&gt;grid-row-start&lt;/code&gt; and &lt;code&gt;grid-row-end&lt;/code&gt; properties. It lets us specify the vertical starting position of a grid item along the row grid lines in the grid container and where the grid item should end, spanning down the grid.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This causes the height of the grid item to span down from row line 2 to row line 5 in the grid.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bringing it all to a single property: grid
&lt;/h2&gt;

&lt;p&gt;Lastly, we come to the last of the CSS Grid shorthand properties — &lt;code&gt;grid.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The CSS property &lt;code&gt;grid&lt;/code&gt; is a shorthand property that lets us set a value for each of the explicit grid container properties such as 'grid-template-rows,' 'grid-template-columns,' and 'grid-template-areas,' and for each implicit grid container properties such as '&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows" rel="noopener noreferrer"&gt;grid-auto-rows&lt;/a&gt;,' '&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns" rel="noopener noreferrer"&gt;grid-auto-columns&lt;/a&gt;,' and '&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow" rel="noopener noreferrer"&gt;grid-auto-flow&lt;/a&gt;,' in a single declaration.&lt;/p&gt;

&lt;p&gt;Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;grid-template&amp;gt; | &amp;lt;grid-template-rows&amp;gt; / [ auto-flow &amp;amp;&amp;amp; dense? ] &amp;lt;grid-auto-columns&amp;gt;? | [ auto-flow &amp;amp;&amp;amp; dense? ] &amp;lt;grid-auto-rows&amp;gt;? / &amp;lt;grid-template-columns&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can read more about it &lt;a href="https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try out CSS Grid yourself!
&lt;/h2&gt;

&lt;p&gt;Creating the perfect layout for your website has never been easier. With CSS Grid, you can create complex layouts with as few lines of CSS, minimal development time, and less dependence on external libraries and frameworks.&lt;/p&gt;

&lt;p&gt;You should now have a solid grasp of the CSS Grid layout, how it works, and how you can use it to lay out content on your websites. We'd love you to give it a try.&lt;/p&gt;

&lt;p&gt;This article was written by &lt;a href="https://twitter.com/Victor_codejs" rel="noopener noreferrer"&gt;Victor Ikechukwu&lt;/a&gt;. Victor is a front-end developer and technical writer interested in the JAMStack. He has a knack for breaking down developer concepts into clear, understandable bits for others.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Everything You Need to Know about All 11 CSS Filters</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Tue, 19 Jul 2022 13:03:56 +0000</pubDate>
      <link>https://forem.com/coderpad/everything-you-need-to-know-about-all-11-css-filters-d4g</link>
      <guid>https://forem.com/coderpad/everything-you-need-to-know-about-all-11-css-filters-d4g</guid>
      <description>&lt;p&gt;CSS, the language for visually styling elements on the web, has evolved to include features that can change an element’s visual effects in a website’s source code – freeing you from the need for graphical and photo editing software. Enter CSS filters.&lt;/p&gt;

&lt;p&gt;CSS filters allow developers to alter an HTML element (usually an image) appearance before it gets displayed in the browser. It provides various operations that can be performed on an element to change its visual properties—for example, increasing the brightness of an image, enhancing an element's color intensity, adding a blur effect, and much more.&lt;/p&gt;

&lt;p&gt;There are 11 filters in CSS, which are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;blur&lt;/li&gt;
&lt;li&gt;brightness&lt;/li&gt;
&lt;li&gt;contrast&lt;/li&gt;
&lt;li&gt;grayscale&lt;/li&gt;
&lt;li&gt;hue-rotate&lt;/li&gt;
&lt;li&gt;invert&lt;/li&gt;
&lt;li&gt;opacity&lt;/li&gt;
&lt;li&gt;saturate&lt;/li&gt;
&lt;li&gt;sepia&lt;/li&gt;
&lt;li&gt;drop-shadow&lt;/li&gt;
&lt;li&gt;url&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide will walk you through each CSS filter, what they are, how they work, and how you can use them in your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Do CSS Filters Work?
&lt;/h2&gt;

&lt;p&gt;We can apply CSS filters to an element by declaring the CSS filter property within the element's style block, passing one or more of the 11 CSS filters as its value.&lt;/p&gt;

&lt;p&gt;Syntax:&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="nt"&gt;element&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;contrast&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;drop-shadow&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;grayscale&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;hue-rotate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;invert&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;saturate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sepia&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="sx"&gt;url()&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;Notice that each filter has an opening and closing parenthesis after its name. That is because each filter is a CSS function that accepts either a length, percentage, or degree value, signifying how much of the filter should be applied to an element.&lt;/p&gt;

&lt;p&gt;Now, let's look at how each CSS filter works in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  blur
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.blurry&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="err"&gt;&amp;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;The CSS blur filter applies a &lt;a href="https://en.m.wikipedia.org/wiki/Gaussian_blur"&gt;Gaussian blur&lt;/a&gt; visual effect to an element. It accepts a &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#lengths"&gt;CSS length unit&lt;/a&gt; (px, rem, em, etc.) to determine how many pixels on the screen need to blend into each other to generate a blurred result. The larger the value of the CSS length unit passed to the filter, the more blur is applied to the element. If we do not provide a value, a default value of 0 is used.&lt;/p&gt;

&lt;p&gt;For the blur filter (and all CSS filters covered in this article) we'll use the image below to demonstrate each filter's effect on an element.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NPXn-aaf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1658097591248/cKr-_rvil.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NPXn-aaf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1658097591248/cKr-_rvil.png" alt="Photo by Fox from Pexels" width="880" height="587"&gt;&lt;/a&gt;&lt;br&gt;
Photo by &lt;a href="https://www.pexels.com/photo/three-men-watching-camera-holding-by-a-woman-1615810/"&gt;Fox from Pexels&lt;/a&gt;                                           &lt;/p&gt;

&lt;p&gt;The code below adds a blur effect of 3px to the image:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3px&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;Here is the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mjZi-eUq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/CPRgoFw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mjZi-eUq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/CPRgoFw.png" alt="The result of the blur filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  brightness
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.exposed&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;decimal&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="err"&gt;&amp;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;The brightness filter adjusts the brightness level of an image. The filter applies a linear multiplier to the input image, making it appear brighter or darker.&lt;/p&gt;

&lt;p&gt;It accepts a decimal value between 0 and 1, or a percentage value. A value of 0 results in a completely black image. A value of 100% or 1 leaves the image as is with its original brightness level. Values greater or less than 100% or 1 determine how dark or bright the image will be.&lt;/p&gt;

&lt;p&gt;Note that all filter functions that accept decimal values do not work with negative integers (-10, for example) but only accept positive numbers.&lt;/p&gt;

&lt;p&gt;The brightness filter has a default percentage and numerical value of 100% and 1. Passing a percentage or numerical value lower than these numbers reduces the image brightness level, giving it the appearance of having a shadow cast over it. The lower the value the higher the intensity of the shadow cast over it is.&lt;/p&gt;

&lt;p&gt;The code below applies the brightness filter with a percentage value of 35% to an image:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;35%&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2vtN6dR---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/7B16sIF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2vtN6dR---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/7B16sIF.png" alt="The result of the brightness filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The opposite effect occurs when you pass a percentage or numerical value greater than 100% and 1 to the filter function. It increases the image's brightness level to make it appear like a photo that has been over-exposed to too much light.&lt;/p&gt;

&lt;p&gt;The code below applies the brightness filter with a value of 135% to an image.&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;135%&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6FNCbbSg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/1AXtOIF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6FNCbbSg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/1AXtOIF.png" alt="The result of the brightness filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  contrast
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.sharpen&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;contrast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;decimal&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="err"&gt;&amp;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;The contrast filter adjusts the brightness difference between the darkest and lightest parts of an image, giving the image a more or less enhanced look. &lt;/p&gt;

&lt;p&gt;It accepts a percentage or decimal value to determine the contrast level of an image — a value of 0 results in a completely gray image. Values above 100% and 1 increase the contrast, and parameters below decrease the contrast of the image.&lt;/p&gt;

&lt;p&gt;The code below adds a contrast level of 180% to an image:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;contrast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;180%&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xp6RJchE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Jqj7Pce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xp6RJchE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Jqj7Pce.png" alt="The result of the contrast filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  grayscale
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.black-and-white&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grayscale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;decimal&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="err"&gt;&amp;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;In digital photography, an image contains both color information and luminance (brightness) information. The grayscale filter removes all color information (a representation of the three light sources — red, green, and blue (RGB) used to produce colors on a computer screen) from an image. It leaves only the luminance information — a range of monochromic (gray) shades, with pure white as the lightest shade, pure black as the darkest shade, and every other shade in between being a shade of gray — known as the grayscale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cNvYm8-r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/KMe6IF3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cNvYm8-r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/KMe6IF3.png" alt="An illustration of the grayscale color range" width="880" height="468"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://calcolor.co/palette/942409461"&gt;An illustration of the grayscale color range&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The grayscale filter removes all color information from an image and sets its color to a tone in the grayscale.&lt;/p&gt;

&lt;p&gt;It accepts a decimal value between 0 and 1, or a percentage value up to 100%. A value of 100% or 1 results in a completely gray image. The image would remain unchanged with a value of 0% or 0, and values between 0% and 100% give it a tone between its original color and complete gray, making the image have a desaturated look.&lt;/p&gt;

&lt;p&gt;The code below uses the grayscale filter to make an image completely gray:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grayscale&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6-pO3Omu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/X4ZfudK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6-pO3Omu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/X4ZfudK.png" alt="The result of the grayscale filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Typical applications where the grayscale filter could come into use would be &lt;a href="https://medium.com/dev-channel/re-colorization-for-dark-mode-19e2e17b584b"&gt;applying it to images when dark mode is enabled&lt;/a&gt; to slightly reduce the overall vibrancy of colors, putting less eye strain on the user. You might also use it to &lt;a href="https://coderpad.io/customers/"&gt;make client logos gray&lt;/a&gt; when listing them on a website.&lt;/p&gt;

&lt;h2&gt;
  
  
  hue-rotate
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.change-color&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hue-rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;angle&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;zero&lt;/span&gt;&lt;span class="err"&gt;&amp;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;Digital photography uses a concept known as the color wheel, an organization of colors around a circle, showing the relationships between the primary, secondary, and tertiary colors to produce colors on a computer screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HYPArP9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/fFE5AV6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HYPArP9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/fFE5AV6.png" alt="An illustration of the color wheel" width="536" height="564"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://neiloseman.com/colour-schemes/rgb-color-wheel-500/"&gt;An illustration of the color wheel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each color in the color wheel has a property called hue, the position of the color (in angle degrees) on the wheel.&lt;/p&gt;

&lt;p&gt;The hue-rotate filter accepts a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/angle"&gt;CSS angle value&lt;/a&gt; (&lt;code&gt;deg&lt;/code&gt;, &lt;code&gt;grad&lt;/code&gt;, &lt;code&gt;rad&lt;/code&gt;, or &lt;code&gt;turn&lt;/code&gt;) and shifts the hue value of each color present on an element relative to the amount you specify, updating all colors relative to their hue's starting point.&lt;/p&gt;

&lt;p&gt;For example, red is at 0 degrees on the color wheel, and blue is at 240 degrees. If a portion of an image contains red, passing a value of &lt;code&gt;240deg&lt;/code&gt; to the &lt;code&gt;hue-rotate&lt;/code&gt; filter will shift the hues of all the colors on the image by 240 degrees, turning that part of the image from red to blue.&lt;/p&gt;

&lt;p&gt;The code below adds a hue rotation of 180 degrees to an image:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hue-rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;180deg&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DsNvXDGB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/IgurdYJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DsNvXDGB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/IgurdYJ.png" alt="The result of the hue-rotate filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note, the unit identifier for the hue-rotate filter is optional for zero angles. For example, both &lt;code&gt;rotate(0deg)&lt;/code&gt; and &lt;code&gt;rotate(0)&lt;/code&gt; are valid, but &lt;code&gt;hue-rotate(45)&lt;/code&gt; is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  invert
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.turn-color-negative&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;invert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;decimal&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="err"&gt;&amp;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;Remember the color wheel mentioned in the section above? When applied to an element or image, the CSS invert filter flips the hue of every color present by 180 degrees, converting each color to the color directly opposite it on the color wheel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HYPArP9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/fFE5AV6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HYPArP9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/fFE5AV6.png" alt="An illustration of the color wheel" width="536" height="564"&gt;&lt;/a&gt;&lt;br&gt;
An illustration of the color wheel&lt;/p&gt;

&lt;p&gt;Bright areas become dark, red becomes cyan, magenta turns green, blue becomes yellow, and vice-versa, giving the image a color-negative effect.&lt;/p&gt;

&lt;p&gt;The invert filter accepts a decimal value between 0 and 1, or a percentage value up to 100% that controls the extent of the color-negative effect. A value of 0.5 or 50% turns an image completely gray.&lt;/p&gt;

&lt;p&gt;The code below inverts the colors on an image by 80%:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;invert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;80%&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1G6vEdR8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/hRY2Ix6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1G6vEdR8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/hRY2Ix6.png" alt="The result of the invert filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  opacity
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.transparent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;decimal&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="err"&gt;&amp;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;The opacity filter applies a transparency effect to an element's colors. It accepts a percentage or decimal value to decide how much transparency to apply to an image. An opacity of 0% or 0 will result in a completely transparent element. 100% opacity will show no transparency. Setting the opacity between 0% and 100% will give the element or image partial transparency.&lt;/p&gt;

&lt;p&gt;The code below adds an opacity of 35% to an image:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;35%&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yDfgEr0B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/LqqOsJr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yDfgEr0B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/LqqOsJr.png" alt="The result of the opacity filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might notice that the opacity filter works just like the CSS &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/opacity"&gt;opacity property&lt;/a&gt; because both control how transparent an element should be. The difference and why you should prefer the opacity filter over the CSS opacity property is that CSS filters are hardware-accelerated. &lt;/p&gt;

&lt;p&gt;When you use the opacity filter to add opacity to an element, the browser will offload the computing task onto the Graphics Processing Unit (GPU) — a specialized processor designed to accelerate graphics rendering within the system. This increases the browser's efficiency and frees up the CPU to perform other tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  saturate
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.enhance&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;saturate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;decimal&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="err"&gt;&amp;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;The CSS saturate filter enhances or decreases the intensity of a color, known as its saturation, making it appear more or less vivid.&lt;/p&gt;

&lt;p&gt;It accepts a decimal value between 0 and 1, or a percentage value. A value of 100% or 1 keeps the color as is. A value above 100% or 1 amplifies the color's intensity, making it more vibrant (saturated), while values below that reduce the color's intensity, making the color grayed and dull (desaturated).&lt;/p&gt;

&lt;p&gt;The code below applies a 172% saturation to an image:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;saturate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;172%&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bzKXC6Qy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/d1Bsfbf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bzKXC6Qy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/d1Bsfbf.png" alt="The result of the saturate filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  sepia
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.nineties-effect&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sepia&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;decimal&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;percentage&lt;/span&gt;&lt;span class="err"&gt;&amp;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;The sepia filter adds a soft brownish color tone to an image, giving it a warmer and vintage appearance that is calming to the eye. It is similar to using the grayscale filter but with a brownish color tone.&lt;/p&gt;

&lt;p&gt;It accepts a decimal value between 0 and 1, or a percentage value up to 100%. A value of 0 leaves the image unchanged. A value of 100% or 1 changes the image entirely to sepia, and values between 0% and 100% give the image a tone between its original color and completely sepia.&lt;/p&gt;

&lt;p&gt;The code below calls the sepia filter with a percentage value of 100%, converting the image to be completely sepia:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sepia&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FTxW4tD---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/CN6eZ9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FTxW4tD---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/CN6eZ9v.png" alt="The result of the sepia filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  drop-shadow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.shadow&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;drop-shadow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;offset-x&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;offset-y&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;blur-radius&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="err"&gt;&amp;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;The CSS drop-shadow filter applies an (often blurry) background shadow to an element, giving it a more three-dimensional look.&lt;/p&gt;

&lt;p&gt;The drop-shadow filter accepts four parameters when applying a drop shadow to an element:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;offset-x&amp;gt;&lt;/code&gt;: A CSS length value that specifies the horizontal distance between the element and the drop shadow. Positive values place the shadow to the element's right, and negative values place the shadow to the left.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;offset-y&amp;gt;&lt;/code&gt;: A CSS length value that specifies the vertical distance between the element and the drop shadow. Positive values place the shadow below the element, and negative values place the shadow above it.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;blur-radius&amp;gt;&lt;/code&gt;: The blur radius of the shadow is specified as a CSS length unit. The larger the value, the more blurred the shadow becomes. If left unspecified, it defaults to 0, producing a sharp and unblurred shadow. No negative values are permitted.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;color&amp;gt;&lt;/code&gt;: The color of the shadow, specified as a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value"&gt;CSS color&lt;/a&gt;. If left unspecified, it defaults to the color black.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of setting a drop shadow to an element:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;drop-shadow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;30px&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt; &lt;span class="m"&gt;#000&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 code above adds a black shadow with a 50px blur to the image, setting it 30px to the right of the image and 30px below it.&lt;/p&gt;

&lt;p&gt;Here's the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JKDpWBjC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/lWPJrWX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JKDpWBjC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/lWPJrWX.png" alt="The result of the drop-shadow filter" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;drop-shadow&lt;/code&gt; filter looks much like the CSS &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow"&gt;box-shadow&lt;/a&gt; property at first glance. However, there's a difference between the two, and it's worth comparing those differences to know when to prefer one over the other.&lt;/p&gt;

&lt;p&gt;One difference between the &lt;code&gt;drop-shadow&lt;/code&gt; filter and the &lt;code&gt;box-shadow&lt;/code&gt; property is the &lt;code&gt;drop-shadow&lt;/code&gt; filter does not accept the &lt;code&gt;inset&lt;/code&gt; keyword, which, when set, rather than aligning the shadow behind the element, inserts the shadow within the element, giving it a framed appearance.&lt;/p&gt;

&lt;p&gt;For example:&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="nt"&gt;div&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;200px&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;200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;inset&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt; &lt;span class="m"&gt;#000&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pe6MhfyE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/8pL9ONb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pe6MhfyE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/8pL9ONb.png" alt="The result of the box-shadow filter using the insert keyword" width="880" height="726"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result of using the &lt;code&gt;insert&lt;/code&gt; keyword that's only available to the &lt;code&gt;box-shadow&lt;/code&gt; property to insert the shadow into the div.&lt;/p&gt;

&lt;p&gt;Another difference between the &lt;code&gt;drop-shadow&lt;/code&gt; filter and the &lt;code&gt;box-shadow&lt;/code&gt; property is the &lt;code&gt;drop-shadow&lt;/code&gt; filter does not accept the  parameter — a CSS length value that specifies how wide the shadow will span. Positive values cause the shadow to enlarge, and negative values cause the shadow to shrink. If not specified, it will default to a value of 0 (the shadow will be the same size as the element).&lt;/p&gt;

&lt;p&gt;Example:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt; &lt;span class="m"&gt;40px&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt; &lt;span class="m"&gt;70px&lt;/span&gt; &lt;span class="no"&gt;gray&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 code above adds a gray shadow with a 50px blur to an image, passing an additional length value of 70px that signifies the shadow will span 50px more than the image in width.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1tEtML6f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/FNUhbOs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1tEtML6f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/FNUhbOs.png" alt="The result of the brightness filter using the spread-radius value" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, to explain the significant difference between the &lt;code&gt;drop-shadow&lt;/code&gt; filter and the &lt;code&gt;box-shadow&lt;/code&gt; property, we'll be using the CoderPad logo below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8VeWs84v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/lWrcVxW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8VeWs84v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/lWrcVxW.png" alt="The CoderPad logo" width="880" height="467"&gt;&lt;/a&gt;&lt;br&gt;
The CoderPad logo&lt;/p&gt;

&lt;p&gt;If the &lt;code&gt;box-shadow&lt;/code&gt; property is used to add a shadow to the CoderPad logo above:&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;.coderpad&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt; &lt;span class="m"&gt;#000&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 results to the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7PON74Ef--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/QzQHBaR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7PON74Ef--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/QzQHBaR.png" alt="Imgur" width="880" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that the shadow is applied to a rectangular box around the logo? This is because CSS uses a &lt;a href="https://www.w3.org/TR/CSS2/box.html"&gt;box model&lt;/a&gt;, where the edges of an element are bound in a rectangular box containing its padding, border, and margin properties. Even in cases where the element does not appear to have a rectangular shape, the box is still there, which is where the shadow will be applied.&lt;/p&gt;

&lt;p&gt;CSS filters are not bound to the box model. That means that the drop-shadow filter will only consider the outline of the CoderPad logo, ignoring its box model so that only the contents of the logo receive the shadow.&lt;/p&gt;

&lt;p&gt;For example:&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;.coderpad&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;drop-shadow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;15px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;28px&lt;/span&gt; &lt;span class="m"&gt;#000&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uHZImyZf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/zXzmFVg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uHZImyZf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/zXzmFVg.png" alt="Imgur" width="880" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deciding which method to use between &lt;code&gt;drop-shadow&lt;/code&gt; and &lt;code&gt;box-shadow&lt;/code&gt; is totally up to you based on the effect you want to achieve.&lt;/p&gt;

&lt;h2&gt;
  
  
  url
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.svg-filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
&lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url('#selector-of-your-svg-filter-here')&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

&lt;span class="c"&gt;/* you can also load filters from external SVGs this way: */&lt;/span&gt; 
&lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url('filters.svg#name-of-your-other-filter-here')&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 url filter takes a string value pointing to an SVG filter element and applies its effects to an HTML element.&lt;/p&gt;

&lt;p&gt;The SVG filter element &lt;code&gt;&amp;lt;filter&amp;gt;&amp;lt;/filter&amp;gt;&lt;/code&gt; is used to add special visual effects to SVG graphics.&lt;/p&gt;

&lt;p&gt;Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;svg&amp;gt;&lt;/span&gt; 
    &lt;span class="nt"&gt;&amp;lt;defs&amp;gt;&lt;/span&gt; 
        &lt;span class="nt"&gt;&amp;lt;filter&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"name-your-filter-here"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
             ... &lt;span class="c"&gt;&amp;lt;!-- insert filters here --&amp;gt;&lt;/span&gt; ... 
        &lt;span class="nt"&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt; ... 
    &lt;span class="nt"&gt;&amp;lt;/defs&amp;gt;&lt;/span&gt; 
&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;&amp;lt;filter&amp;gt;&lt;/code&gt; tag takes a required id attribute to identify the filter. We can then use the url filter to apply the SVG filters to HTML elements using either the id selector of the filter or a link to it.&lt;/p&gt;

&lt;p&gt;For example, the code below defines a blur filter using the &lt;br&gt;
&lt;code&gt;&amp;lt;feGaussianBlur&amp;gt;&lt;/code&gt; filter tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt; &lt;span class="nt"&gt;&amp;lt;svg&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;defs&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;filter&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"blur-filter"&lt;/span&gt; &lt;span class="na"&gt;x=&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt; &lt;span class="na"&gt;y=&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;feGaussianBlur&lt;/span&gt; &lt;span class="na"&gt;in=&lt;/span&gt;&lt;span class="s"&gt;"SourceGraphic"&lt;/span&gt; &lt;span class="na"&gt;stdDeviation=&lt;/span&gt;&lt;span class="s"&gt;"8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/defs&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you can apply the SVG filter to an element by passing its id to the url filter:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url("#blur-filter")&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;Here's the result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QyLU9qn9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/HOR32j9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QyLU9qn9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/HOR32j9.png" alt="Imgur" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Usage Notes
&lt;/h2&gt;

&lt;p&gt;Here are a few more points to note when using CSS filters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Multiple CSS Filters
&lt;/h3&gt;

&lt;p&gt;Throughout this article, we have only looked at using a single CSS filter per section. However, you may combine two or more CSS filters to manipulate the rendering of an element.&lt;/p&gt;

&lt;p&gt;Syntax:&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;.multiple-effects&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;brightness&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;contrast&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;drop-shadow&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;grayscale&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt;          &lt;span class="n"&gt;hue-rotate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;invert&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;saturate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;sepia&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="sx"&gt;url()&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;We can pass two or more of the 11 CSS filters to the filter property, and CSS applies them to the element according to the order they appear.&lt;/p&gt;

&lt;p&gt;For example:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;drop-shadow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;20px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="no"&gt;black&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 &lt;code&gt;opacity&lt;/code&gt; filter comes first in the filter property in the code above before the &lt;code&gt;drop-shadow&lt;/code&gt;. When rendering the image in the browser, CSS will apply an opacity of 50% to the image, making it partially transparent, before adding a drop-shadow.&lt;/p&gt;

&lt;p&gt;Here's the result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CfCl2U4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/FyM9vQM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CfCl2U4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/FyM9vQM.png" alt="Imgur" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reversing the order of the filter properties changes the result:&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="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;drop-shadow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;20px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;50%&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 result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fI8LQrrm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/nImQxFh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fI8LQrrm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/nImQxFh.png" alt="Imgur" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Usage with the initial and inherit keywords
&lt;/h3&gt;

&lt;p&gt;In addition to the 11 CSS filters, the filter property accepts two extra values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;initial&lt;/code&gt;: The default value of the filter property — resolves to "none".&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;inherit&lt;/code&gt;: The computed value of the filter property from an element's direct parent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Try using CSS filters yourself!
&lt;/h1&gt;

&lt;p&gt;Hopefully, you now have a thorough understanding of all 11 CSS filters, how they work, and how you can use them to apply different visual effects to the elements on your websites.&lt;/p&gt;

&lt;p&gt;CSS filters give you more independence from photo editing software when creating production assets and visual effects for your websites—helping save on both time and money. They enable you to apply these visual effects directly in the browser. &lt;/p&gt;

&lt;p&gt;If you'd like to read more informative articles from CoderPad's blog, check out the related posts below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://coderpad.io/blog/development/the-complete-guide-to-regular-expressions-regex/"&gt;The Complete Guide to Regular Expressions (Regex)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://coderpad.io/blog/development/rules-of-reacts-useeffect/"&gt;Rules of React's useEffect&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://coderpad.io/blog/development/intro-to-jamstack-with-salma-alam-naylor/"&gt;Dev Discussions: Intro to the Jamstack with Salma Alam-Naylor of Netlify&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Replace Occurrences of a String in JavaScript</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Sat, 13 Nov 2021 16:24:39 +0000</pubDate>
      <link>https://forem.com/iamvictor/replace-occurrences-of-a-string-in-javascript-1clo</link>
      <guid>https://forem.com/iamvictor/replace-occurrences-of-a-string-in-javascript-1clo</guid>
      <description>&lt;p&gt;There are a couple of ways to replace the occurrence of a substring in JavaScript.&lt;/p&gt;

&lt;p&gt;In this article, you will learn how to replace the occurrence of a string with the built-in &lt;code&gt;replace&lt;/code&gt;, and &lt;code&gt;replaceAll&lt;/code&gt; methods provided by the &lt;code&gt;String&lt;/code&gt; type and how to use them. &lt;/p&gt;

&lt;p&gt;They allow you to replace the occurrences of a substring in a string and return the new version of the string.&lt;/p&gt;

&lt;p&gt;Note that both methods don’t change the original string, but return the new string with the specified substrings replaced with a new value. Let's see how.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using &lt;code&gt;String.replace&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;replace&lt;/code&gt; method accepts two arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;pattern&lt;/code&gt; — A string to search for, it could be a string or a regex pattern.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;replacement&lt;/code&gt; — The text to replace the &lt;code&gt;pattern&lt;/code&gt; with.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And replaces a substring in a string with a new one and returns the new string.&lt;/p&gt;

&lt;p&gt;Syntax:&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;newString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;oldString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;replacement&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's take a look at an example:&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;quote&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Voldamot is the greatest Wizard. Voldemort will rule the world!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newQuote&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Voldamot&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Harry Potter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;//outputs: Harry Potter is the greatest Wizard. Voldamot will rule the world!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, only the first occurrence of the substring &lt;code&gt;Voldamot&lt;/code&gt; was replaced with the new substring &lt;code&gt;Harry Potter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To use the &lt;code&gt;replace&lt;/code&gt; method to replace all occurrences of a substring in a string with a new one, you must use a &lt;a href="https://link"&gt;regular expression&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using regular expressions
&lt;/h3&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;newString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;oldString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;replacement&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the &lt;code&gt;replace&lt;/code&gt; method accepts a regular expression as the &lt;code&gt;searchValue&lt;/code&gt;. it then replaces them with the &lt;code&gt;newSubstr&lt;/code&gt;, and returns a new string.&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;quote&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Voldamot is the greatest Wizard. Voldemort will rule the world!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newQuote&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;quote&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/Voldamot/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Harry Potter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;//outputs: Harry Potter is the greatest Wizard. Harry Potter will rule the world!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By passing the global flag &lt;code&gt;(g)&lt;/code&gt; to the regex pattern, it tells the &lt;code&gt;replace&lt;/code&gt; method to search for all occurrences of &lt;code&gt;Voldamot&lt;/code&gt; in the string, and replace them with &lt;code&gt;Harry Potter&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using &lt;code&gt;String.replaceAll&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Trying to replace all occurrences of a substring with the &lt;code&gt;replace&lt;/code&gt; method can be quite a workaround. The &lt;code&gt;String&lt;/code&gt; type provides a method that is more straightforward in achieving this, &lt;code&gt;replaceAll&lt;/code&gt;.&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;newString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;oldString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replaceAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;replacement&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Introduced in ES2021, the &lt;code&gt;replaceAll&lt;/code&gt; method is a sequel to the &lt;a href="https://link"&gt;String.replace&lt;/a&gt;. The &lt;code&gt;replaceAll&lt;/code&gt; method returns a new string in which all occurrences of  &lt;code&gt;pattern&lt;/code&gt; are replaced by the &lt;code&gt;replacement&lt;/code&gt; passed to it.&lt;/p&gt;

&lt;p&gt;Example:&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;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;David is a self-taught developer. David will rule the world!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newStr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replaceAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;David&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Victor&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;//output: Victor is a self-taught developer. Victor will rule the world!.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No need for regular expressions here, making the process seamless.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;And that’s it. The &lt;code&gt;String&lt;/code&gt; type provides two methods to replace occurrences of a string:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;replace()&lt;/code&gt;: only replaces the first occurrence of the substring with replacement, also accepts regular expressions, and uses the &lt;code&gt;g&lt;/code&gt; flag to replace all occurrences of the substring with a new one.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;replaceAll()&lt;/code&gt;: replaces all occurrences of the substring, method is more straightforward.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And you’re good to go! thanks for reading and, happy coding!.&lt;/p&gt;

&lt;p&gt;&lt;a href=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.buymeacoffee.com/molipa"&gt;&lt;br&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bJz-zci7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.buymeacoffee.com/button-api/%3Ftext%3DBuy%2520me%2520a%2520Coffee%2520%25E2%2598%2595%2520%26emoji%3D%25F0%259F%258D%25A6%26slug%3Dmolipa%26button_colour%3D40DCA5%26font_colour%3Dffffff%26font_family%3DComic%26outline_colour%3D000000%26coffee_colour%3DFFDD00" width="280" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Tools for Web Developers To Work Smarter and not Harder</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Fri, 25 Jun 2021 13:30:23 +0000</pubDate>
      <link>https://forem.com/iamvictor/tools-for-web-developers-to-work-smarter-and-not-harder-3c0</link>
      <guid>https://forem.com/iamvictor/tools-for-web-developers-to-work-smarter-and-not-harder-3c0</guid>
      <description>&lt;blockquote&gt;
     "A man is only as good as his tools" &lt;br&gt;
        &lt;span&gt; -Emmert Wolf&lt;/span&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the software development industry. This would closely mean &lt;code&gt;A Developer is only as good as his tools&lt;/code&gt;. As the difference in the productivity levels of two developers with the same technical knowledge is sometimes based on their toolset.&lt;/p&gt;

&lt;p&gt;Hello There 👋, Beautiful Coder on the internet. Welcome back to my blog. In this blog, I write articles about tech, programming, and my life as a teenage developer. In this article, I'm going to round up some of the most interesting front-end developer tools of 2021. Which you will definitely find useful for your own development workflow.&lt;/p&gt;

&lt;p&gt;The key to being a productive developer is to work smarter and not harder. using tools that speed up most of the tasks that you do. Making you more productive and simplify your work.&lt;/p&gt;

&lt;p&gt;These development tools aren't really the most popular or hottest in 2021 👉👈, but they do come in handy for me, simplifying my work and making me more productive. As am sure they will too for you 😏. Already excited, let’s get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ Web Developer
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612731404%2FSSf1J7EqO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612731404%2FSSf1J7EqO.png" alt="chrispederick.com_work_web-developer_ (1).png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First up, &lt;a href=""&gt;Web Developer&lt;/a&gt;. This is definitely my favorite tool in the list, hence it comes first 😄. The &lt;a href="https://chrispederick.com/work/web-developer/" rel="noopener noreferrer"&gt;Web Developer&lt;/a&gt; is a browser extension that comes bundled with various &lt;strong&gt;web developer tools&lt;/strong&gt;.  Web Developer extension adds various web developer tools to a browser. Add it to your web browser and take development to the next level. The extension is available for Chrome, Firefox, and Opera.&lt;/p&gt;

&lt;p&gt;Once installed. you can open a panel like this.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612685949%2FeBEbhkMYS.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612685949%2FeBEbhkMYS.webp" alt="menu-600.webp"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That gives you access to lot of amazing commands like, Toggle CSS and JavaScript for a site on or off, view the semantic structure of a site, inspect how it looks on various screen sizes, disable images to see if the have alt text. The list is endless 😄. &lt;/p&gt;

&lt;h2&gt;
  
  
  QUOKKA.JS
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624613505289%2FwMtE2-GM-.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624613505289%2FwMtE2-GM-.webp" alt="QUOKKA.JS"&gt;&lt;/a&gt;&lt;br&gt;
&lt;code&gt;RAPID JAVASCRIPT PROTOTYPING IN YOUR EDITOR&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://quokkajs.com/" rel="noopener noreferrer"&gt;Quokka&lt;/a&gt; is a developer productivity tool, That helps developers to rapidly prototype JavaScript or Typescript Code right in their code editor. Quokka makes &lt;strong&gt;prototyping&lt;/strong&gt;,&lt;strong&gt;learning&lt;/strong&gt; and &lt;strong&gt;testing&lt;/strong&gt; JavaScript and Typescript code &lt;strong&gt;blazingly fast&lt;/strong&gt;. With Quokka, there are no configurations required by default. All you need to do is simply start up a JavaScript/Typescript file and you are ready to go 👍. &lt;/p&gt;

&lt;p&gt;To get started using Quokka, you can install it as an extension in your code editor. Head over to their website and get the version for your code editor and directions on how to set it up. Quokka has two editions, The &lt;strong&gt;Community&lt;/strong&gt; edition which is free for everyone but has a few limitations, &lt;code&gt;bear this in mind 👀&lt;/code&gt;. And a commercial &lt;strong&gt;Pro&lt;/strong&gt; edition that provides some additional features but you have to pay for it.&lt;/p&gt;

&lt;p&gt;Here's a sneak peek of it in action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624611653071%2FIQrIHNHvN.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624611653071%2FIQrIHNHvN.gif" alt="vsc-live.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Google Lighthouse
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612660170%2FpxznS8mUJ.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612660170%2FpxznS8mUJ.webp" alt="Google Lighthouse"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coding is a very demanding task. And as such, it is common to make mistakes, decrease the overall quality of your site. And that's where Google Lighthouse comes in.&lt;br&gt;
&lt;a href="https://developers.google.com/web/tools/lighthouse/" rel="noopener noreferrer"&gt;Google Lighthouse&lt;/a&gt; is an open-source, automated development tool for testing/improving the quality of your web pages. &lt;/p&gt;

&lt;p&gt;Google Lighthouse lets you audit(examine) your web applications based on several parameters, including performance, accessibility, mobile compatibility, Progressive Web App (PWA) implementations, SEO, and more. All you have to do is run it on a page or pass it a URL, sit back and get a very elaborate report with amazing feedback on how to improve the quality and performance of your site. All  in just a few clicks. &lt;/p&gt;

&lt;p&gt;You can get started with Google Lighthouse if you have the &lt;a href="https://www.google.com/chrome/browser/desktop/?" rel="noopener noreferrer"&gt;Google Chrome for Desktop&lt;/a&gt; Browser. Or If you are a fan of the Command-Line, then you can use the &lt;a href="https://www.npmjs.com/package/lighthouse?&amp;amp;url=151?&amp;amp;url=85" rel="noopener noreferrer"&gt;Lighthouse NPM package &lt;/a&gt; and its CLI.&lt;/p&gt;

&lt;p&gt;See this article on &lt;a href="https://flexiple.com/developers/using-google-lighthouse-to-audit-your-web-application/" rel="noopener noreferrer"&gt;using Google Lighthouse &lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Grammerly
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612455290%2Fb5wNLimow.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612455290%2Fb5wNLimow.webp" alt="grammarly"&gt;&lt;/a&gt;&lt;br&gt;
&lt;code&gt;Say Goodbye to Textfails&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;One for the Technical writers. &lt;a href="https://www.grammarly.com/" rel="noopener noreferrer"&gt;Grammerly&lt;/a&gt; is a writing assistant that puts your writing at its best. Grammerly scans what you write for common grammatical mistakes (like misused commas) and complex ones (like misplaced modifiers). Personally, as a technical writer. Grammerly has really helped me improve my writing skills and confidence in blogging, which has lead to better typo-free quality articles. As am sure it will for you 🙌.&lt;/p&gt;

&lt;h2&gt;
  
  
  Webflow
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624611874913%2Fs18KYlOot.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624611874913%2Fs18KYlOot.webp" alt="webflow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.webflow.com/" rel="noopener noreferrer"&gt;Web flow&lt;/a&gt; provides a modern way for pretty much anyone (even non-technical people) to design and build for the web. It is a free low-code platform for rapidly building custom responsive web apps in a visual canvas with no code. It automatically generates Html, CSS, and JavaScript codes from your designs. That your team can quickly import and plugin into the site's codebase.&lt;/p&gt;

&lt;p&gt;With the help of Webflow, designing and building responsive web apps becomes as easy as drag and drop the UI components you need. There is no need to spend days or even months making UI/UX decisions, fighting with state management, setting up access control, or re-inventing the wheel. Saving everyone the stress of &lt;strong&gt;repetitively coding everything from scratch&lt;/strong&gt; 😍. This is especially helpful if you freelance. Designing and launching web pages would only take a matter of days.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tabnine
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612177967%2Ft4F_xCv-k.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612177967%2Ft4F_xCv-k.webp" alt="Tabnine"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everyone's favorite AI code autocompletion tool 😄. Trusted by over 1 million developers in all programming languages. &lt;a href="https://www.tabnine.com/" rel="noopener noreferrer"&gt;Tabnine&lt;/a&gt; helps developers write code with some magics. It's based on a system of deep learning to help developers &lt;strong&gt;code faster, reduce mistakes, and discover best coding practices&lt;/strong&gt; using Machine Learning. It removes the burden of having to remember code syntax and lets you actually focus on writing &lt;strong&gt;good&lt;/strong&gt; code. And writing it faster, which is the whole point of writing this article, right? 😏. start using Tabnine today to 10X your workflow 😎, by installing it as an extension in your code editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tailwind CSS
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612126087%2Fj9ZW6jaV3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1624612126087%2Fj9ZW6jaV3.webp" alt="Tailwind CSS "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tailwindcss.com" rel="noopener noreferrer"&gt;Tailwind CSS&lt;/a&gt; is a utility-first framework for rapidly building custom user interface (UI) components. This means that, unlike other CSS libraries, it doesn’t provide pre-styled components and classes that’ll have all your projects looking the same (insert Bootstrap). Instead, it provides low-level utility classes for styling virtually every single CSS property like padding (e.g. pt-10), flex (e.g. justify-between), color (e.g. blue-600), and so on. This way, you get to build &lt;strong&gt;unique custom interfaces&lt;/strong&gt;, &lt;strong&gt;make better design decisions&lt;/strong&gt; because it limits your choices via limited class variations. You’ll also never have to worry about naming CSS classes anymore. In fact, With Tailwind CSS. you may almost never need to &lt;strong&gt;write CSS again&lt;/strong&gt;. Awesome, right? 😃&lt;/p&gt;

&lt;p&gt;If you want to start using Tailwind CSS for your project, see this article on &lt;a href="https://blog.logrocket.com/tailwind-css-is-it-tomorrows-bootstrap-ebe560f9d00b/" rel="noopener noreferrer"&gt;getting started with Tailwind CSS&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Daily.dev
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://daily.dev/" rel="noopener noreferrer"&gt;Daily.dev&lt;/a&gt; is a news aggregator, especially for software developers. to help them stay up to date with the latest news in tech. With daily.dev, you will stay updated with the best articles from the best tech publications on any topic. Get all the content you love in one place -- CSS-Tricks, Smashing Magazine, web.dev, hashnode, and +350 sources.&lt;/p&gt;

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

&lt;p&gt;And that's it guys, I hope you are excited to start using these tools, cause I am too 😁, There are a ton more tools out there, but these are my top picks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do you know more?
&lt;/h3&gt;

&lt;p&gt;Also, if there’s any other amazing tool you’ve been using that has improved your workflow somehow, The ones you are getting excited to try out yet. Drop them in the comments!. Your Feedbacks are greatly appreciated! 🙌. I too, would love to expand my stash 😄. Have an amazing day!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enjoyed reading this as much as i enjoyed writing it for you? 😍&lt;/strong&gt; . support me 😃&lt;br&gt;
&lt;a href="https://www.buymeacoffee.com/molipa" rel="noopener noreferrer"&gt;&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.buymeacoffee.com%2Fbutton-api%2F%3Ftext%3DBuy%2520me%2520a%2520Coffee%2520%25E2%2598%2595%2520%26emoji%3D%25F0%259F%258D%25A6%26slug%3Dmolipa%26button_colour%3D40DCA5%26font_colour%3Dffffff%26font_family%3DComic%26outline_colour%3D000000%26coffee_colour%3DFFDD00"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;there's nothing more I would like than we become friends on &lt;a href="https://twitter.com/VectorIkechukwu" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; 💖&lt;/p&gt;

&lt;p&gt;If you found this article helpful, please like and share it: really motivates me to publish more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thanks so much for reading! 💖 And keep on coding! 👨‍💻.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>The History Of JavaScript ⌛</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Tue, 22 Jun 2021 23:35:48 +0000</pubDate>
      <link>https://forem.com/iamvictor/the-history-of-javascript-1fp3</link>
      <guid>https://forem.com/iamvictor/the-history-of-javascript-1fp3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Nowadays JavaScript is everywhere 🌍&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hello 👋, Beautiful Coders on the internet 😃. In this article, I would share with you a quick yet comprehensive overview of how the most popular and widely used programming language in the world evolved to be what it is today.&lt;/p&gt;

&lt;p&gt;Over the years JavaScript has become the most popular and versatile programming language. Powering over 97% of the web. As a web developer knowing the history of the most popular and in-demand programming language is a plus that will help enhance your understanding of the language.&lt;/p&gt;

&lt;h3&gt;
  
  
  1995: The Birth of JavaScript
&lt;/h3&gt;

&lt;p&gt;Back in May 1995, the internet was becoming popular. The web back then was just static pages that were often text-heavy and ugly 😌.&lt;/p&gt;

&lt;p&gt;the best ones had images floated to the left or right. Not exciting when you compare it to the web today 🤔&lt;/p&gt;

&lt;p&gt;The Web needed to be more dynamic. Animations, interactions, and other forms of small automation needed to be the future of the web. To achieve that future the web needed a scripting programming language that ran in the browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Brendan_Eich" rel="noopener noreferrer"&gt;Brendan Eich&lt;/a&gt; a programmer at Netscape was given the job to make this possible and in just ten days he created the JavaScript programming language (originally called Mocha during its development and then changed to LiveScript )&lt;/p&gt;

&lt;p&gt;On December 4, 1995, the internet saw the first release of the JavaScript programming language&lt;/p&gt;

&lt;h3&gt;
  
  
  1996: JavaScript vs. Java
&lt;/h3&gt;

&lt;p&gt;Shortly after its release its name was changed from LiveScript to JavaScript. Many say the reason for the change was to attract developers of another buzzed programming language that was very popular at the time. Which was Java.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The "Java" in JavaScript was just for marketing reasons only 💡.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because the language itself JavaScript has nothing to do with Java! ☝&lt;/p&gt;

&lt;p&gt;Java is a statically typed, compiled programming language, on the other hand. (vanilla) JavaScript is dynamically typed, and interpreted at run-time. check this &lt;a href="a%0Ahref=%22https://www.javatpoint.com/difference-between-java-and-javascript%22"&gt;article &lt;/a&gt;for more concise details on the differences btw Java and JavaScript&lt;/p&gt;

&lt;p&gt;Many beginners intertwine the two languages as one 👀. But no. JavaScript and Java are actually two complete different programming languages&lt;/p&gt;

&lt;h3&gt;
  
  
  1997: ECMAScript Is Born As The JavaScript Standard
&lt;/h3&gt;

&lt;p&gt;A year later, in 1997. JavaScript had experienced rapid growth as many developers adopted the language and more browsers started adding JavaScript support. It became clear that the language would need to be properly maintained and managed. Therefore Netscape and the developers of the language submitted the JavaScript programming language to the standards organization &lt;a href="a%0Ahref=%22https://www.ecma-international.org%22"&gt;European Computer Manufacturers Associate (ECMA) International&lt;/a&gt; a Swiss organization to define international standards for computing. For consideration as the industry standard.&lt;/p&gt;

&lt;p&gt;a technical committee at EMCA known as &lt;a href="https://tc39.es/" rel="noopener noreferrer"&gt;TC39&lt;/a&gt; is the organization behind the standardization of the ECMAScript (JavaScript) specification. The TC39 committee is a group of JavaScript developers, implementers, academics, and more from different companies including Google, Microsoft, Netflix, Facebook, and Paypal. Their job is for creating, approving, and denying language features, to maintain and evolve the definition of JavaScript&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622409106667%2F8TVDyA-uh.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622409106667%2F8TVDyA-uh.jpeg" alt="tc39.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;with that, the first standard version of the JavaScript language that was supported across all browsers ~ ECMAScript 1 or commonly known as ES1 was released&lt;/p&gt;

&lt;h3&gt;
  
  
  2009: ES5
&lt;/h3&gt;

&lt;p&gt;In 2009 the JavaScript version ES5 (ECMAScript 5) was released with a lot of new major features like JSON support, Getters &amp;amp; Setters on Objects, new array methods like forEach and map that were not yet wildly supported among different browsers. as a result, it took some years for browsers to support these features.  &lt;/p&gt;

&lt;h6&gt;
  
  
  As a Web developer, you must understand ES5, why? 👇
&lt;/h6&gt;

&lt;ul&gt;
&lt;li&gt;ES5 is the standard version of JavaScript Programming, as it is fully supported in all major browsers i.e internet explorer.&lt;/li&gt;
&lt;li&gt;Many &lt;code&gt;(old)&lt;/code&gt; codebases are still written in ES5.&lt;/li&gt;
&lt;li&gt;it's better and easier to learn the fundamentals in ES5, and then update to ES6 and ESNext.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2015: Anticipated Update of the year ~ ES6/ES2015
&lt;/h3&gt;

&lt;p&gt;In June 2015, the much-awaited and anticipated version of the language 😄 &lt;strong&gt;ES6&lt;/strong&gt; was released &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622406530419%2Fod92Nllw-.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622406530419%2Fod92Nllw-.gif" alt="Its Like The Album Of The Year&amp;lt;br&amp;gt;
"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Which was &lt;strong&gt;the biggest update to the language ever!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ES6 brought new syntax and awesome features to make your code more modern and readable. It allows you to write less code and do more. ES6 introduces many great features like arrow functions, template literals, classes, destructing, Modules… and more.&lt;/p&gt;

&lt;p&gt;This was(is) a really big deal for the whole JavaScript community.&lt;/p&gt;

&lt;p&gt;Ever since the major 2015 ES6 release, The TC39 committee changed to an annual release cycle. This means a new version of JavaScript with just a few new features is released every year. Instead of shipping a huge new version, with a ton of features every couple of years 😔.&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s next? ESNext
&lt;/h3&gt;

&lt;p&gt;ESNext is the name that indicates the next version of JavaScript(ECMAScript) that is to be released.&lt;/p&gt;

&lt;p&gt;As of the time of writing, the current ECMAScript version is ES2020(ES11). It was released in June 2020.&lt;/p&gt;

&lt;p&gt;It is usually common for JavaScript editions to be standardized during the summer, so we can expect ECMAScript 2021(ES12) to be released this summer 😉.&lt;/p&gt;

&lt;p&gt;At the time of writing, ES2020(ES11) has been released, and ESNext is ES2021(ES12)&lt;/p&gt;

&lt;p&gt;Proposals to the ECMAScript standard are organized in stages. Stages 1–3 are an incubator of new features, and features reaching Stage 4 are finalized as part of the new standard.&lt;/p&gt;

&lt;p&gt;At the time of writing we have several features at Stage 4. The latest versions of the major browsers should already implement most of those.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of JavaScript
&lt;/h3&gt;

&lt;p&gt;In the industry, you often hear terms like vanilla or plain JavaScript. It’s just how developers refer to JavaScript without any frameworks or libraries. We know that ECMAScript 2015 or ES6 is the standard version of vanilla JavaScript. But JavaScript also comes in other forms for example.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622375885446%2FSekpW5ffc.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622375885446%2FSekpW5ffc.jpeg" alt="typescript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.typescriptlang.org/" rel="noopener noreferrer"&gt;Typescript&lt;/a&gt; was created by Microsoft, it’s a strict syntactical superset of JavaScript, and adds optional static typing to the language. The browser cannot understand a file written in Typescript so it needs to be compiled into standard JavaScript code so it can run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622375963331%2FUrFuFEGNE.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622375963331%2FUrFuFEGNE.jpeg" alt="coffee-script"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://coffeescript.org/" rel="noopener noreferrer"&gt;CoffeeScript&lt;/a&gt; adds syntax sugar to JavaScript that makes it in an effort to enhance JavaScript’s brevity and readability. Its also not understood by rowsers and needs complied into standard JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622375998748%2FfyE6bnpzV.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622375998748%2FfyE6bnpzV.jpeg" alt="dart"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dart.dev/" rel="noopener noreferrer"&gt;Dart&lt;/a&gt; is an object-orientated JavaScript language made by Google. Dart is used to create highly complex and easily scalable apps for the web, mobiles. Dart has been approved by ECMA like vanilla JavaScript. Dart uses a different syntax than vanilla JavaScript but it can be translated into vanilla so it can be used in a browser. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622376024282%2FWdbHQrOJB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622376024282%2FWdbHQrOJB.png" alt="nodejs"&gt;&lt;/a&gt;&lt;a href="https://nodejs.org" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; is a cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command-line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622376049961%2FpC3xXets4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622376049961%2FpC3xXets4.png" alt="reactjs"&gt;&lt;/a&gt;&lt;a href="https://reactjs.org%0A" rel="noopener noreferrer"&gt;React&lt;/a&gt; is a JavaScript front-end library for building user interfaces or UI components. It is maintained by Facebook and a community of individual developers and companies. React is mainly used as a base in the development of single-page or mobile applications. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622376070383%2FzpP12xsUy.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1622376070383%2FzpP12xsUy.jpeg" alt="jquery"&gt;&lt;/a&gt;&lt;a href="https://jquery.com/" rel="noopener noreferrer"&gt;Jquery&lt;/a&gt; was made to simplify JavaScript making it easier to learn. It takes a lot of common JavaScript tasks that need lots of code to write in vanilla and wrap them into a single line. The Jquery contains features like DOM traversal and manipulation, event handling, Animation, and even Ajax. Jquery doesn’t need to be compiled and will run in all major browsers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where is JavaScript Today
&lt;/h3&gt;

&lt;p&gt;Although the origins of JavaScript started in the web browser, it has now evolved beyond that to become a multi-platform language. Supporting all major paradigms of programming.  &lt;/p&gt;

&lt;p&gt;The most common place you’ll encounter JavaScript is on the web. Developers now use JavaScript to make websites more engaging with things like 3D graphics, animations, transitions, and more. It’s also possible to build native mobile apps that run both on iOS and Android using JavaScript.&lt;/p&gt;

&lt;p&gt;frameworks like React &amp;amp; Ionic. You can even find JavaScript in Desktop applications like the text editor Visual Studio Code 😏 and popular messaging apps like Slack. It can be used to control hardware with IoT devices.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrapping Up
&lt;/h3&gt;

&lt;p&gt;I hope this article helped you. Now you have a nice overview of the history/ evolution of the most popular programming language of the web.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is a topic that could come up in an interview 🤷‍♂️, so yeah it's worth knowing&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you would like to chat or have any questions, drop them in the comments I’m always happy to talk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I hope you learned something new from this, Thanks so much for reading!! ❤ And keep on coding! 👨‍💻.&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enjoyed reading this as much as i enjoyed writing it for you? 😍&lt;/strong&gt;. support me with a coffee 😃&lt;a href="https://www.buymeacoffee.com/molipa" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.buymeacoffee.com%2Fbutton-api%2F%3Ftext%3DBuy%2520me%2520a%2520Coffee%2520%25E2%2598%2595%2520%26emoji%3D%25F0%259F%258D%25A6%26slug%3Dmolipa%26button_colour%3D40DCA5%26font_colour%3Dffffff%26font_family%3DComic%26outline_colour%3D000000%26coffee_colour%3DFFDD00" alt="buy me a coffee"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/VectorIkechukwu" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2F-Follow%2520me%2520on%2520Twitter-1877F2%3Fstyle%3Dflat%26logo%3DTwitter%26logoColor%3Dwhite" alt="Follow me on Twitter"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>developers</category>
      <category>react</category>
      <category>node</category>
    </item>
    <item>
      <title>Understanding JavaScript Array Methods</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Wed, 16 Jun 2021 00:49:33 +0000</pubDate>
      <link>https://forem.com/iamvictor/understanding-javascript-array-methods-44fj</link>
      <guid>https://forem.com/iamvictor/understanding-javascript-array-methods-44fj</guid>
      <description>&lt;h3&gt;
  
  
  If you're a JavaScript developer, then you should be familiar with the most commonly used ES5 and ES6+ array methods.
&lt;/h3&gt;

&lt;p&gt;These methods make coding in JavaScript a lot easier and also make your code look clean and easy to understand to everyone.&lt;/p&gt;

&lt;p&gt;So in this article, we are going to explore some of the most important and widely used array methods used in JavaScript. So let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Array.forEach Method
&lt;/h2&gt;

&lt;p&gt;The  &lt;code&gt;Array.forEach&lt;/code&gt; method has the following syntax:&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="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callbackfn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;array&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;blockquote&gt;
&lt;p&gt;The &lt;code&gt;forEach&lt;/code&gt; method executes a provided callback function once for every element in the array.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&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;months&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;January&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;February&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;March&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;April&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;May&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;June&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;months&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;month&lt;/span&gt;&lt;span class="p"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;month&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="cm"&gt;/* output
January
February
March
April
May
June
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a  &lt;a href="https://codepen.io/Vickyfloxy/pen/LYbgWdY" rel="noopener noreferrer"&gt;Codepen Sample&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Here, inside the &lt;code&gt;forEach&lt;/code&gt; loop callback function, each element of the array is automatically passed as the first parameter of the function.  &lt;/p&gt;

&lt;p&gt;One important thing you need to keep in mind is that the forEach method does not return any value.&lt;/p&gt;

&lt;p&gt;Take a look at the below code:&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;workDays&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Monday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Tuesday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Wednesday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Thursday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;returnedValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;workDays&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;day&lt;/span&gt;&lt;span class="p"&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="nf"&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;returnedValue: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;returnedValue&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note that &lt;code&gt;forEach&lt;/code&gt; is only used to loop through the array and perform some processing or logging. It does not return any value, even if you explicitly &lt;code&gt;return&lt;/code&gt; a value from the callback &lt;code&gt;function&lt;/code&gt; (this means that the returned value comes as &lt;code&gt;undefined&lt;/code&gt; in the above example).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Advantages of using the Array.forEach Method
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Using a forEach loop makes your code shorter and easier to understand&lt;/li&gt;
&lt;li&gt;When using a forEach loop, we don't need to keep track of how many elements are available in the array. So it avoids the creation of an extra counter variable.&lt;/li&gt;
&lt;li&gt;Using a forEach loop makes code easy to debug because there are no extra variables for looping through the array&lt;/li&gt;
&lt;li&gt;The forEach loop automatically stops when all the elements of the array are finished iterating.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Array.map Method
&lt;/h2&gt;

&lt;p&gt;The Array map method is the most useful and widely used array method among all other methods.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Array.map&lt;/code&gt; method has the following syntax:&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="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callbackfn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;array&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;blockquote&gt;
&lt;p&gt;The map method executes a provided callback function once on every element in the array and it &lt;strong&gt;returns a new transformed array&lt;/strong&gt;. that contains the results.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Take a look at the below code:&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;workDays&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Monday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Tuesday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Wednesday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Thursday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Friday&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;upperDays&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;workDays&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;day&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleUpperCase&lt;/span&gt;&lt;span class="p"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;upperDays&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;//output ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY','FRIDAY']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a &lt;a href="https://codepen.io/Vickyfloxy/pen/wvoYJOp" rel="noopener noreferrer"&gt;Code Sample&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In the above code, inside the callback function, we’re converting each element to uppercase and returning it.&lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;map&lt;/code&gt; method helps to avoid creating a separate converted array beforehand for storing the converted elements. So it saves memory space and also the code looks much cleaner using &lt;code&gt;Array.map&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that the &lt;code&gt;map&lt;/code&gt; method returns a new array that is of the exact same length as the original array.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The difference between the &lt;code&gt;forEach&lt;/code&gt; and map methods is that &lt;code&gt;forEach&lt;/code&gt; is only used for looping and does not return anything back. On the other hand, the &lt;code&gt;map&lt;/code&gt; method returns a new array that is of the exact same length as the original array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Also, note that &lt;code&gt;map&lt;/code&gt; does not change the original array but returns a new array.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The array &lt;code&gt;map&lt;/code&gt; method is also useful if you want to extract only specific data from the array like this:&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;workers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Mike&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sheridan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Tim&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Lee&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Carte&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Paul&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Victor&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;workersAges&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;workers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;workersAges&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;//output: [30, 45, 25, 22]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a &lt;a href="https://codepen.io/Vickyfloxy/pen/zYoMYjE" rel="noopener noreferrer"&gt;Code Sample&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In the above code, we're extracting only the age of each worker and storing them in a new array.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of using the map method
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It helps quickly generate a new array without changing the original array&lt;/li&gt;
&lt;li&gt;It allows us to quickly extract any element of the array&lt;/li&gt;
&lt;li&gt;It generates an array with the exact same length as the original array&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Array.find Method
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Array.find&lt;/code&gt; method has the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Array.find(predicate: (value: element, index: number, array: []))&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;find&lt;/code&gt; method returns the value of the first element in the array that satisfies the provided test condition. and undefined otherwise.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;find&lt;/code&gt; method takes a callback function &lt;code&gt;(predicate)&lt;/code&gt; as the first argument and executes the callback function &lt;code&gt;(predicate)&lt;/code&gt;for every element of the array. Each array element value is passed as the first parameter to the callback function.&lt;/p&gt;

&lt;p&gt;Suppose, we have a list of employees like this:&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;employees&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;David Carlson&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Copper&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mike Sheridan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Carte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&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;and we want to get the record for the employee whose age is less than 30. In this case, we can use the find method as shown below:&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;underAgeWorker&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="p"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;underAgeWorker&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;// outputs: {name: "John Copper", age: 25}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a  &lt;a href="https://codepen.io/Vickyfloxy/pen/jOVQEPB" rel="noopener noreferrer"&gt;Code Sample&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Even though there is &lt;code&gt;"Mike Sheridan"&lt;/code&gt; in the list whose age is also less than 30, the find method will stop when it finds the first match. So it will not return the first object with an age less than 30. &lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of using the find method
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It allows us to quickly find any element without writing a lot of code&lt;/li&gt;
&lt;li&gt;It stops looping as soon as it finds a match so there is no need for an extra break statement&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Array.findIndex Method
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Array.findIndex&lt;/code&gt; method has the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Array.findIndex(callbackfn: (value: element, index: number, array: []))&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;findIndex&lt;/code&gt; method returns the &lt;strong&gt;index&lt;/strong&gt; of the first element in the array &lt;strong&gt;that satisfies the provided test condition&lt;/strong&gt;. Otherwise, it returns -1, indicating that no element passed the test.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&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;employees&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;David Carlson&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Copper&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mike Sheridan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Carte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;// outputs:  1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we get the output as 1 which is the index of the first object with the name John. Note that the index of an array starts with zero.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of using the findIndex method
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It allows us to quickly find the index of an element without writing a lot of code&lt;/li&gt;
&lt;li&gt;It stops looping as soon as it finds a match so there is no need for an extra break statement&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Array.filter Method
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Array.filter&lt;/code&gt; method has the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Array.filter(callbackfn: (value: element, index: number, array: []))&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;filter&lt;/code&gt; method takes a callback function as the first argument and executes the callback function for every element of the array and returns &lt;code&gt;a new array&lt;/code&gt; with all the elements that meet the condition specified in the callback function.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So using the &lt;code&gt;filter&lt;/code&gt; method, it does not stop when it finds a particular match but keeps checking for other elements in the array that match the condition. Then it returns all the matching elements from the array.&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;employees&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;David Carlson&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Cooper&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mike Sheridan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John Carte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;];&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;employee&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;employee&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;//output [ { name: "John Cooper", age: 24 }, { name: "Mike Sheridan", age: 25 } ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note that the &lt;code&gt;filter&lt;/code&gt; method always returns an array. If no element passes the test condition, an empty array will be returned.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Advantages of using the filter method
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It allows us to quickly find all the matching elements from the array&lt;/li&gt;
&lt;li&gt;It always returns an array even if there is no match, so it avoids writing extra if conditions&lt;/li&gt;
&lt;li&gt;It avoids the need of creating an extra variable to store the filtered elements&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Array.every Method
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Array.every&lt;/code&gt; method has the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Array.every(callbackfn: (value: any, index: number, array: []))&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;every&lt;/code&gt; method tests whether all elements in the array pass the provided test conditions and returns a boolean &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; value.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Imagine you have a registration form, and you want to check if all of the required fields are entered or not before submitting the form. You can use the &lt;code&gt;every&lt;/code&gt; method to check for each field value easily.&lt;br&gt;
      Here's a &lt;a href="https://codepen.io/Vickyfloxy/pen/XWNypxe" rel="noopener noreferrer"&gt;Code Sample&lt;/a&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  Advantage of using the every method
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It lets us to quickly check if all the elements match certain criteria without writing a lot of code&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  The Array.reduce Method
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Array.reduce&lt;/code&gt; method has the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Array.reduce(callbackfn: (accumulator: any, currentValue: any, Index: number, array: []), initialValue)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;reduce&lt;/code&gt; method executes a &lt;strong&gt;reducer&lt;/strong&gt; function (that you provide) on each element of the array, resulting in a single output value.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that the output of the &lt;code&gt;reduce&lt;/code&gt; method is always a single value. It can be an object, a number, a string, an array, and so on. It depends on what you want the output of &lt;code&gt;reduce&lt;/code&gt; method to generate but it's always a single value.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&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;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accumulator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;0&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;reduce&lt;/code&gt; method accepts a callback function that receives &lt;code&gt;accumulator&lt;/code&gt;, &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;index&lt;/code&gt; and &lt;code&gt;array&lt;/code&gt; as the values. In the above code, we’re using only &lt;code&gt;accumulator&lt;/code&gt; and &lt;code&gt;number&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;accumulator&lt;/code&gt; will contain the &lt;code&gt;initialValue&lt;/code&gt; to be used for the &lt;code&gt;array&lt;/code&gt;. The &lt;code&gt;initialValue&lt;/code&gt; decides the return type of the data returned by the &lt;code&gt;reduce&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;number&lt;/code&gt; is the second parameter to the callback function that will contain the &lt;code&gt;array&lt;/code&gt; element&lt;br&gt;
during each iteration of the loop.&lt;/p&gt;

&lt;p&gt;In the above code, we have provided &lt;code&gt;0&lt;/code&gt; as the &lt;code&gt;initialValue&lt;/code&gt; for the &lt;code&gt;accumulator&lt;/code&gt;. So the first time the callback function executes, the &lt;code&gt;accumulator&lt;/code&gt; + &lt;code&gt;number&lt;/code&gt; will be &lt;code&gt;0 + 1 = 1&lt;/code&gt; and we're returning back the value &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The next time the callback function runs, &lt;code&gt;accumulator&lt;/code&gt; + &lt;code&gt;number&lt;/code&gt; will be &lt;code&gt;1 + 2 = 3&lt;/code&gt; (&lt;code&gt;1&lt;/code&gt; here is&lt;br&gt;
the previous value returned in the last iteration and &lt;code&gt;2&lt;/code&gt; is the next element from the &lt;code&gt;array&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Then, the next time the callback function runs, &lt;code&gt;accumulator&lt;/code&gt; + &lt;code&gt;number&lt;/code&gt; will be&lt;code&gt;3 + 3 = 6&lt;/code&gt; (the first &lt;code&gt;3&lt;/code&gt; here is the previous value returned in the last iteration and the next &lt;code&gt;3&lt;/code&gt; is the next element from the &lt;code&gt;array&lt;/code&gt;) and it will continue this way until all the elements in the &lt;code&gt;number&lt;/code&gt;s &lt;code&gt;array&lt;/code&gt; are not iterated.&lt;/p&gt;

&lt;p&gt;So the &lt;code&gt;accumulator&lt;/code&gt; will retain the value of the last operation just like a static variable.&lt;/p&gt;

&lt;p&gt;In the above code, &lt;code&gt;initialValue&lt;/code&gt; of &lt;code&gt;0&lt;/code&gt; is not required because all the elements of the &lt;code&gt;array&lt;/code&gt; are&lt;br&gt;
integers.&lt;/p&gt;
&lt;h3&gt;
  
  
  Advantages of using the reduce method
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Using reduce allows us to generate any type of simple or complex data based on the array&lt;/li&gt;
&lt;li&gt;It remembers the previously returns data from the loop so helps us avoid creating a global variable to store the previous value&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Thanks so much for reading!&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1615377822628%2FWxinRNMgC.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1615377822628%2FWxinRNMgC.gif" alt="thank-you.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;That's all from me guys. hoped you've learned a little bit about the awesome JavaScript Array and its methods *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you still have any questions, don't hesitate to reach out in the comments section below! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Want to stay up to date with regular content regarding JavaScript, Python, And How to code in general? Follow me on  &lt;a href="https://twitter.com/VectorIkechukwu" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; .&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;
**Enjoyed reading this as much as I enjoyed writing it for you? 😍** . support me with a coffee 😃
&lt;a href="https://www.buymeacoffee.com/molipa" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.buymeacoffee.com%2Fbuttons%2Fv2%2Fdefault-yellow.png" alt="Buy Me A Coffee"&gt;&lt;/a&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Getting Comfortable With CSS Selectors (Part 2) pseudo-classes and pseudo-elements in CSS</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Mon, 14 Jun 2021 07:07:34 +0000</pubDate>
      <link>https://forem.com/iamvictor/getting-comfortable-with-css-selectors-part-2-pseudo-classes-and-pseudo-elements-in-css-nkb</link>
      <guid>https://forem.com/iamvictor/getting-comfortable-with-css-selectors-part-2-pseudo-classes-and-pseudo-elements-in-css-nkb</guid>
      <description>&lt;p&gt;Hello everyone 👋‍, Welcome back to my series, &lt;a href="https://vickyikechukwu.hashnode.dev/series/css-selectors" rel="noopener noreferrer"&gt;Getting Comfortable With CSS Selectors&lt;/a&gt;,&lt;br&gt;
if this is the first post in the series you are reading, I recommend checking out my previous article &lt;a href="https://vickyikechukwu.hashnode.dev/getting-comfortable-with-css-selectors-part-1" rel="noopener noreferrer"&gt;Getting Comfortable With CSS Selectors (Part 1)&lt;/a&gt; to follow up in the in series 😉. &lt;/p&gt;

&lt;p&gt;in this article, we are going to continue from where we left off in the first part of the series, where we talked about some of the selectors we have in CSS. we will be looking at the &lt;code&gt;Pseudo-Classes&lt;/code&gt; and &lt;code&gt;Pseudo-Elements&lt;/code&gt; CSS selectors. sounds cool right? let's get into it 👇.&lt;/p&gt;

&lt;h1&gt;Pseudo-classes&lt;/h1&gt;

&lt;blockquote&gt;
CSS pseudo-classes are not exactly selectors on their own, they are keywords added to a CSS selector and let developers specify a special state of the selected element(s).
&lt;/blockquote&gt;

&lt;blockquote&gt;
&lt;p&gt;All Pseudo-class selectors in CSS are preceded by a colon &lt;code&gt;:&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  1. X:hover
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Any button over which the user's pointer is hovering */&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;pink&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&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;One of the most commonly used pseudo-class the &lt;code&gt;:hover&lt;/code&gt; &lt;code&gt;pseudo-class&lt;/code&gt;, which is used to style element(s) in the hover state &lt;code&gt;(when the user hovers our them with a pointing device, usually a mouse)&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;so in the example, we would give every link a color of pink when it is been hovered on. Want to apply specific styling when a user hovers over an element? This will get the job done! 👍.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. X:focus
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt; &lt;span class="c"&gt;/* Selects any &amp;lt;input&amp;gt; with the field class when focused */&lt;/span&gt; 
&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="nc"&gt;.field&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;blue&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 &lt;code&gt;:focus&lt;/code&gt; CSS &lt;code&gt;pseudo-class&lt;/code&gt; represents an element (usually a form input) that has received focus (accepts keyboard or mouse events, or other forms of input).&lt;/p&gt;

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

&lt;p&gt;in the codepen the &lt;code&gt;:focus&lt;/code&gt; &lt;code&gt;pseudo-class&lt;/code&gt; is used to give input with the &lt;code&gt;red-class&lt;/code&gt; &lt;code&gt;class&lt;/code&gt; a red background and a blue background to the input with the &lt;code&gt;blue-class&lt;/code&gt; &lt;code&gt;class&lt;/code&gt; whenever they are focused on.&lt;/p&gt;

&lt;h2&gt;
  
  
  3 X:nth-of-type(n)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects every second &amp;lt;p&amp;gt; element among any group of siblings */&lt;/span&gt;
&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="nd"&gt;:nth-of-type&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;2&lt;/span&gt;&lt;span class="nt"&gt;n&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;lime&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 &lt;code&gt;:nth-of-type()&lt;/code&gt; CSS &lt;code&gt;pseudo-class&lt;/code&gt; selects elements(selectors) of a given type based on their position/location among a group of siblings.&lt;/p&gt;

&lt;p&gt;say we have a &lt;code&gt;ul&lt;/code&gt; and we want to style every &lt;code&gt;li&lt;/code&gt;  whose numeric position in the list is even, no need to give them a special &lt;code&gt;class&lt;/code&gt;, we could do that with the &lt;code&gt;:nth-of-type()&lt;/code&gt; &lt;code&gt;pseudo-class&lt;/code&gt; selector!&lt;/p&gt;

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

&lt;p&gt;&lt;br&gt;&lt;br&gt;
What about those whose numeric position in the list is odd, we got it covered&lt;/p&gt;

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



&lt;h2&gt;
  
  
  4. X:first-of-type
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;:first-of-type&lt;/code&gt; &lt;code&gt;pseudo-class&lt;/code&gt; Same as &lt;code&gt;:nth-of-type(1)&lt;/code&gt;. Represents an element that is the first sibling of its type in the list of children of its parent element.&lt;br&gt;
So if I wanted the first &lt;code&gt;li&lt;/code&gt; to have a different style from its siblings, I could easily do that using the &lt;code&gt;:first-of-type&lt;/code&gt; pseudo-class&lt;/p&gt;

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

&lt;h2&gt;
  
  
  5. X:visited
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects any &amp;lt;a&amp;gt; that has been visited */&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nd"&gt;:visited&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;purple&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;In some websites, it's common to apply some special styles to links that the user has visited so that when they come back to the page, they can know the external links they have visited already.&lt;br&gt;
This can be done with &lt;code&gt;:visited&lt;/code&gt; CSS &lt;code&gt;pseudo-class&lt;/code&gt; as its styles only apply to links that have been visited by the user. &lt;/p&gt;

&lt;h1&gt;Pseudo-elements&lt;/h1&gt;

&lt;p&gt;We've got another interesting group called &lt;code&gt;pseudo-elements&lt;/code&gt;&lt;br&gt;
CSS &lt;code&gt;pseudo-elements&lt;/code&gt; are keywords added to a selector that lets you style a particular part of the selected element(s).&lt;/p&gt;

&lt;p&gt;I know, i know, it seems similar to CSS &lt;code&gt;pseudo-classes&lt;/code&gt; right 🤔. Well there are two main differences between them&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;pseudo-elements&lt;/code&gt; are preceded with two colons &lt;code&gt;::&lt;/code&gt; instead of one, although these days modern browsers are more forgiving and support both single &lt;code&gt;:&lt;/code&gt; and double &lt;code&gt;::&lt;/code&gt; colons for the &lt;code&gt;pseudo-elements&lt;/code&gt;. But it is a best practice to use two colons &lt;code&gt;::&lt;/code&gt; 😏&lt;/p&gt;
&lt;/blockquote&gt;&lt;/li&gt;
&lt;li&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;pseudo-classes&lt;/code&gt; are all about state, when we speak of state, I mean things like a visited link, a focused input field, an image that is being hovered upon, etc. While &lt;code&gt;pseudo-elements&lt;/code&gt; are used to style sections or a particular part of of an element, things like the first letter in a word, the first line, etc.&lt;/p&gt;
&lt;/blockquote&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  6. X::first-letter (:first-letter)
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;::first-letter&lt;/code&gt; represents the first letter on the first line of a block-level element, as long it is not coming after an image or a table.&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="nt"&gt;selector&lt;/span&gt;&lt;span class="nd"&gt;::first-letter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;property&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&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;&lt;iframe height="600" src="https://codepen.io/Vickyfloxy/embed/XWpPvjm?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;as you can we use the &lt;code&gt;::first-letter&lt;/code&gt; pseudo-element to make the first letter of every &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; 300% and pink 😁.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. X::selection (:selection)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;selector&lt;/span&gt;&lt;span class="nd"&gt;::selection&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;property&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&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 &lt;code&gt;::selection&lt;/code&gt; &lt;code&gt;pseudo-element&lt;/code&gt; is used to select and style the portion of a document that has been highlighted by the user. This is a really fun pseudo-element selector.&lt;/p&gt;

&lt;p&gt;So if we wanted to overwrite the default styles of the browser that is applied text when they are selected/highlighted in our websites and apply our own custom styles, we can easily do that with the &lt;code&gt;::selection&lt;/code&gt; &lt;code&gt;pseudo-element&lt;/code&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  8. X::before (:before) And X::after (:after)
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt; &lt;code&gt;pseudo-elements&lt;/code&gt; are used to generate styleable content around the selected element's actual content, with the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/content" rel="noopener noreferrer"&gt;CSS content&lt;/a&gt; property.&lt;/p&gt;

&lt;p&gt;we select the selector and after it, we give the &lt;code&gt;content&lt;/code&gt; property a value, and whatever we specify in the value will be added before or after the selector in the Html.&lt;/p&gt;

&lt;blockquote&gt;
   `X::before (:before):` Represents a styleable child pseudo-element immediately before the originating element's actual content.
&lt;/blockquote&gt;   

&lt;blockquote&gt;
   `X::after (:after):` Represents a styleable child pseudo-element immediately after the originating element's actual content.
&lt;/blockquote&gt;  

&lt;p&gt;By default the &lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt; &lt;code&gt;pseudo-elements&lt;/code&gt; create an inline element, that can be styled and modified like any other element in the DOM. this gives us control to create cool interesting effects.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🚨 Note the &lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt; &lt;code&gt;pseudo-element&lt;/code&gt; selectors should only be used to add cosmetic and stylistic content on our page. True content that is actually important for the page should be added to your page's markup.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is an example of using the &lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt; &lt;code&gt;pseudo-element&lt;/code&gt;s i found on Codepen.&lt;/p&gt;

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

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

&lt;p&gt;Alright coder This brings us to the end of the series,  we've covered quite a bit about CSS selectors In this series! 🎉🎉🥂.&lt;/p&gt;

&lt;p&gt;for a more comprehensive guide on CSS selectors check out some of these resources.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Pseudo-classes_and_pseudo-elements" rel="noopener noreferrer"&gt;MDN guide&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes" rel="noopener noreferrer"&gt;MDN Pseudo-classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements" rel="noopener noreferrer"&gt;MDN Pseudo-elements&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you're up for it I have a &lt;a href="https://codepen.io/Vickyfloxy/pen/LYxgYzE" rel="noopener noreferrer"&gt;Little Exercise On Codepen&lt;/a&gt; 😏 For you to test out your knowledge of what we have covered in this series. So I will like you to style the Html using the commented instructions in the CSS panel. Here is the &lt;a href="https://codepen.io/Vickyfloxy/pen/XWpxWeQ" rel="noopener noreferrer"&gt;Codepen Solution&lt;/a&gt; in case you get stuck 🙂.  &lt;/p&gt;

&lt;p&gt;So what are you waiting for, take this knowledge out there and go write some top-notch CSS styles that will impress your friends 💃💃.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/molipa" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.buymeacoffee.com%2Fbuttons%2Fv2%2Fdefault-yellow.png" alt="Buy Me A Coffee"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thanks so much for reading! ❤ And keep on coding! 👨‍💻.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Share and Like it with your friends and feel free to follow me on &lt;a href="https://twitter.com/VectorIkechukwu" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; so you won't miss my latest articles again.&lt;/p&gt;

</description>
      <category>css</category>
      <category>tutorial</category>
      <category>css3</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Getting Comfortable With CSS Selectors (Part 1)</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Sun, 13 Jun 2021 02:38:12 +0000</pubDate>
      <link>https://forem.com/iamvictor/getting-comfortable-with-css-selectors-part-1-24a9</link>
      <guid>https://forem.com/iamvictor/getting-comfortable-with-css-selectors-part-1-24a9</guid>
      <description>&lt;p&gt;So you have learned the basic id, class, and descendant selectors—and then called it a day? If so, you're missing out on an enormous level of flexibility. You owe it to yourself to commit these advanced CSS and CSS3 selectors to memory&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS Rules
&lt;/h2&gt;

&lt;p&gt;Every CSS rule follows this general pattern&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="nt"&gt;selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="py"&gt;property&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&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;where we have of a selector (e.g. h1) and a declaration block ({}) where we declare our styles.&lt;br&gt;
In understanding CSS The biggest key player is understanding selectors and how they work, CSS selectors are what allows us to target specific Html Elements and apply styles in the declaration block to them, we won't be focusing on styles right now though, our focus would be on the selecting and what goes in that selector area &lt;/p&gt;

&lt;p&gt;Let's get into it 👇&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Universal Selector
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Selects everything&lt;/em&gt;&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="c"&gt;/* Selects all elements */&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&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 CSS universal selector is donated by an asterisk ✳. It selects all elements regardless of their type present on the page.&lt;br&gt;
In the example above all elements on the page will get the style of &lt;code&gt;color: black;&lt;/code&gt; assuming we don't have any more specific selectors that conflict with that.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Element (Type) Selector
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects all img */&lt;/span&gt;
&lt;span class="nt"&gt;img&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;200px&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;100px&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 &lt;code&gt;Element&lt;/code&gt; Selector Selects all instances of a tag or element present on the page, in our case, we would be giving all &lt;code&gt;img&lt;/code&gt; HTML elements on the page the specified width and height.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Class Selector
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects all elements with class of 'blue' */&lt;/span&gt;
&lt;span class="nc"&gt;.blue&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;dotted&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="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&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 CSS &lt;code&gt;class&lt;/code&gt; selector is probably the most useful and versatile selector, it selects all elements that have given the &lt;code&gt;class value&lt;/code&gt; in their &lt;code&gt;class&lt;/code&gt; attribute. In the example above it will select all elements that have the "blue" value in their &lt;code&gt;class&lt;/code&gt; attribute&lt;/p&gt;

&lt;h3&gt;
  
  
  4. ID Selector
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects the element with the id attribute set to '#header' */&lt;/span&gt;
&lt;span class="nf"&gt;#header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;dotted&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;200px&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;100px&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;Next, we have the &lt;code&gt;ID&lt;/code&gt; selector. ID selectors are the most powerful in terms of &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity" rel="noopener noreferrer"&gt;CSS specificity&lt;/a&gt;, just like the &lt;code&gt;class&lt;/code&gt; selector, it targets specific elements in our markup, that we can then reference in our CSS. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: The value of an element's &lt;code&gt;ID&lt;/code&gt; must be unique on a web page. It is a violation of the &lt;a href="https://www.w3.org/TR/html/dom.html#the-id-attribute" rel="noopener noreferrer"&gt;HTML standard&lt;/a&gt; to use the value of an ID more than once in the same document tree. id selectors are rigid and don't allow for reuse&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  5. Selector List
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects all matching elements in the list */&lt;/span&gt;
&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&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;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;rgb&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="m"&gt;0&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CSS &lt;code&gt;selector list&lt;/code&gt; &lt;code&gt;(,)&lt;/code&gt; allows us to select multiple elements with &lt;strong&gt;different selectors&lt;/strong&gt; at once and style them. You have more than one thing which uses the same CSS then the individual selectors can be combined into a selector list so that the rule is applied to all of the individual selectors. This is done by grouping them in a comma-separated list and CSS selects all the matching elements in the list&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note:  When you group selectors in this way, if any selector is invalid the whole rule will be ignored.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;&lt;u&gt; Combinator Selectors &lt;/u&gt;&lt;/h1&gt;

&lt;p&gt;This final group of selectors combines other selectors in order to target elements within our documents&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Descendant Combinator
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects all &amp;lt;a&amp;gt;'s that are nested inside an &amp;lt;ul&amp;gt; */&lt;/span&gt;
&lt;span class="nt"&gt;ul&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;dodgerblue&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;This &lt;code&gt;selector&lt;/code&gt; allows us to select elements that are descendants of some other selector. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;we are selecting all &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; nested anywhere within an &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;, it doesn't have to be the first child or first descendant it can be  anywhere nested inside the &lt;code&gt;ul&lt;/code&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  7. Adjacent Sibling Combinator
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects only &amp;lt;p&amp;gt; tags that are immediately preceded by a &amp;lt;h1&amp;gt; */&lt;/span&gt;
&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;dark-grey&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 + combinator selects adjacent element siblings.it will select only the element that is immediately preceded by the former element. In this case, only the first paragraph after each &lt;code&gt;h1&lt;/code&gt; will have dark-grey text. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This means that the second element must directly follow the first, and both share the same parent.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  8. (Direct) Child Combinator
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Selects all &amp;lt;h2&amp;gt; that are direct children of a &amp;lt;div&amp;gt; */&lt;/span&gt;
&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&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 &lt;code&gt;&amp;gt;&lt;/code&gt; combinator acts more like the &lt;code&gt;descendant combinator&lt;/code&gt; expect that it is more particular and selects direct children of the parent element, in the Example: &lt;code&gt;div &amp;gt; h2&lt;/code&gt; will match all &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; elements that are nested directly inside of a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With the &lt;code&gt;descendant combinator&lt;/code&gt; we would select any nested child or grandchild of the parent element. But the child combinator &lt;code&gt;&amp;gt;&lt;/code&gt; selects only direct children.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sorry grandchildren only children allowed 😋.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attribute Selectors
&lt;/h2&gt;

&lt;p&gt;The attribute selectors allow us to select elements based on the presence of a certain attribute on an element:&lt;/p&gt;

&lt;h3&gt;
  
  
  9. X[href="foo"]
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"https://hashnode.com/"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&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 will style all anchor tags which link to &lt;a href="https://hashnode.com/" rel="noopener noreferrer"&gt;https://hashnode.com/&lt;/a&gt;; they'll receive the blue color. All other anchor tags will remain unaffected.&lt;/p&gt;

&lt;p&gt;What if the link does indeed direct to Hashnode, but maybe the path is hashnode.com rather than the full URL?&lt;/p&gt;

&lt;h3&gt;
  
  
  10. X[href*="foo"]
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;href&lt;/span&gt;&lt;span class="o"&gt;*=&lt;/span&gt;&lt;span class="s1"&gt;"hashnode"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&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;There we go. The star designates that the proceeding value must appear somewhere in the attribute's value&lt;/p&gt;

&lt;h3&gt;
  
  
  11. X[href^="http"]
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;href&lt;/span&gt;&lt;span class="o"&gt;^=&lt;/span&gt;&lt;span class="s1"&gt;"http"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;blue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nl"&gt;padding-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&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 carat symbol &lt;code&gt;^&lt;/code&gt; designates the beginning of a string. If we want to target all anchor tags that have an href which begins with http, we could use a selector similar to the snippet shown above.&lt;/p&gt;

&lt;h3&gt;
  
  
  12. X[href$=".jpg"]
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;href&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;".jpg"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&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 symbol &lt;code&gt;$&lt;/code&gt; refers to the end of a string. In this case, we're searching for all anchors which link to an image—or a URL that ends with .jpg.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Alright coder we have covered quite a bit about CSS selectors! 🎉.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Universal Selector&lt;/li&gt;
&lt;li&gt;Element (Type) Selector&lt;/li&gt;
&lt;li&gt;Class and ID Selectors&lt;/li&gt;
&lt;li&gt;Combinators

&lt;ul&gt;
&lt;li&gt;Adjacent, Descendant, and Direct Child Combinators&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Attribute Selectors and their variants.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;In the next part of this series, we are going to talk about &lt;strong&gt;Pseudo Selectors&lt;/strong&gt;, a big and widely confusing topic in CSS 🤔.&lt;/p&gt;

&lt;p&gt;So what are you waiting for, take this knowledge out there and go write some top-notch CSS styles that will impress your friends. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enjoyed reading this as much as i enjoyed writing it for you?&lt;/strong&gt; 😍 . support me with a coffee 😃&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/molipa" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.buymeacoffee.com%2Fbuttons%2Fv2%2Fdefault-yellow.png" alt="Buy Me A Coffee"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>css3</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Deploy a React Application to Netlify</title>
      <dc:creator>Victor Ikechukwu</dc:creator>
      <pubDate>Sun, 13 Jun 2021 02:22:01 +0000</pubDate>
      <link>https://forem.com/iamvictor/deploy-a-react-application-to-netlify-ime</link>
      <guid>https://forem.com/iamvictor/deploy-a-react-application-to-netlify-ime</guid>
      <description>&lt;p&gt;Hey guys 👋, in this article we are going to look at the two different methods that we can use to host and deploy your react applications using Netlify.&lt;/p&gt;

&lt;p&gt;The first method takes less than a minute, &lt;strong&gt;which is crazy&lt;/strong&gt;. and the second method which includes continuous deployments and updates to our app through GitHub will only take you a few minutes to set up 🤠. That's amazing. excited? i am too 😀, let's get right into it 👇.&lt;/p&gt;

&lt;blockquote&gt;
    To follow along with this tutorial, you need to have a &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;Github&lt;/a&gt;
    and
    &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; account. so go to their sites and create one if
    you
    haven't already.
&lt;/blockquote&gt;

&lt;p&gt;with that done. we are going to create a new react app. so that you can follow along 100% of the&lt;br&gt;
way.&lt;/p&gt;

&lt;h1&gt;Create a new React App&lt;/h1&gt;

&lt;p&gt;create a new empty folder on your desktop or any directory of your choice. give it a name. I'm gonna&lt;br&gt;
call mine &lt;code&gt;react_app&lt;/code&gt;. great.&lt;/p&gt;

&lt;p&gt;open it in your VS Code or any editor of your choice.&lt;/p&gt;

&lt;p&gt;Next, we will need to open up a terminal. you can make use of your operating system default Terminal, Git bash, or the integrated terminal that is built-in with VS Code.&lt;/p&gt;

&lt;p&gt;Navigate to the directory where your app is. mine is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;desktop/react_app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;you won't have to do this if you are using the integrated VS code terminal 😏.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From here you will be able to initialize your react app. by simply running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app &lt;span class="o"&gt;(&lt;/span&gt;Name_Of_App&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where &lt;code&gt;(Name_Of_App)&lt;/code&gt; would be what you want to name your react app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This might take some time. so feel free to go make yourself a hot cup of tea ☕ while it runs on your device 😊.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Great!, after that's done your folder structure should look similar to this in your code editor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620856597519%2FuKInHJStX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620856597519%2FuKInHJStX.png" alt="folder structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to start the application and preview it in your browser. you should see something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620787771597%2FEL3y0gHkL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620787771597%2FEL3y0gHkL.png" alt="our react app in the&amp;lt;br&amp;gt;
browser"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great! 🎉🎇. we successfully created a demo react app.&lt;/p&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;p&gt;you can go to the &lt;code&gt;src&lt;/code&gt; folder and edit the &lt;code&gt;App.js&lt;/code&gt; file before deploying. to customize it a bit.&lt;/p&gt;

&lt;p&gt;Something like this.&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;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt; &lt;span class="nx"&gt;first&lt;/span&gt; &lt;span class="nx"&gt;Deployment&lt;/span&gt; &lt;span class="err"&gt;😊🎉&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/header&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;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;Save, and now you should see your edited version in the browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620787837688%2FurYTG9Ea0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620787837688%2FurYTG9Ea0.png" alt="edited version of our&amp;lt;br&amp;gt;
app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great!, now let's focus on the main goal of this article. to show you how we can take our app from the &lt;code&gt;localhost port 3000&lt;/code&gt;&lt;br&gt;
that only we can see. to the internet. so that you can share it with your friends, employers. really anyone.&lt;/p&gt;

&lt;h1&gt; Time to Deploy! &lt;/h1&gt;

&lt;h2&gt; Manual Deployment &lt;/h2&gt;

&lt;p&gt;We are going to try out the first and easiest method of deploying react apps. but you need to have a &lt;br&gt;
&lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; account. so go ahead and signup or log in if you&lt;br&gt;
already have one.&lt;/p&gt;

&lt;p&gt;after logging in. go to the bottom of the page and you will see this empty box. where we can drag and drop our site folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620787999263%2FY9ZxMB8oE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620787999263%2FY9ZxMB8oE.png" alt="image of empty drag-and-drop&amp;lt;br&amp;gt;
box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before getting to it. first, stop the react server by hitting &lt;code&gt;Ctrl C&lt;/code&gt; in our terminal.&lt;br&gt;
next, we would need to &lt;code&gt;build&lt;/code&gt; our react app. simply run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is going to create a &lt;code&gt;built&lt;/code&gt; version of react that our browsers can natively understand. and we can freely deploy on the web. read more about this &lt;br&gt;
&lt;a href="https://docs.npmjs.com/cli/v6/commands/npm-build/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;once done, you should see the &lt;code&gt;build&lt;/code&gt; folder. in your folder structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620788203439%2FJ-c2dJm8a.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620788203439%2FJ-c2dJm8a.jpeg" alt="Folder structure showing the build&amp;lt;br&amp;gt;
folder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;open your react app in finder if you're on a mac or file explorer for windows.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;next, drag and drop the build folder into the empty box on the Netlify page. that is it. after a few seconds, the application should be deployed on the web! 🎉. now we have a real URL&lt;br&gt;
that we can share with people to access the site 😊. that is it this process works for any frontend react application. it's that simple.&lt;/p&gt;

&lt;h2&gt;Automated Deployment&lt;/h2&gt;

&lt;p&gt;One major problem with our current deployed version is that. if we make a change to our source code, the changes are not going to be reflected on the deployed version.&lt;/p&gt;

&lt;p&gt;And this makes sense, because. remember it is the &lt;code&gt;build&lt;/code&gt; folder that contains the version of our app that is accessible by web browsers. And we had manually pushed it to Netlify already, so changes made to our code, won't be reflected on our &lt;code&gt;build&lt;/code&gt; folder on Netlify. unless we &lt;code&gt;build&lt;/code&gt; our app again. and deploy it manually again 👀.&lt;/p&gt;

&lt;p&gt;As you can see this process is impossible 😞🤦‍♂️.&lt;/p&gt;

&lt;p&gt;🤔 So how do we deploy our applications so that, all the changes made to the code are reflected on the deployed site, each time we push to Github.&lt;/p&gt;

&lt;p&gt;To do that we need to add the project to a Github repository. go to &lt;a href=""&gt;Github&lt;/a&gt; and create a new empty repository for your app. follow this guide on the &lt;a href="https://docs.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line" rel="noopener noreferrer"&gt;Github docs&lt;/a&gt;, on how to connect your app to a remote repo on github.&lt;/p&gt;

&lt;p&gt;once your repo is connected to your app. run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;on your terminal to push your code to GitHub.&lt;/p&gt;

&lt;p&gt;we can head back to Netlify. scroll to the top and press on the "New site from Git" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620788502193%2Fr73NY6HC1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620788502193%2Fr73NY6HC1.png" alt="image of "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will be asked to choose the Git provider where your site’s source code is hosted. When you push&lt;br&gt;
to Git.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Then you can search for the specific repository you wish to deploy, among all your Github&lt;br&gt;
repositories. Click on it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620857044256%2FPTFyg0dYN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620857044256%2FPTFyg0dYN.png" alt="A list of our GitHub repository "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the "Deploy" button.&lt;/p&gt;

&lt;p&gt;And there you have it!. your app is now Live!. congratulations! 🎉&lt;/p&gt;

&lt;h3&gt;Proving that our Deployment is Automated&lt;/h3&gt;

&lt;p&gt;Now, whenever you push to Github. Netlify would automatically &lt;code&gt;build&lt;/code&gt; our app for us and update our&lt;br&gt;
deployed version.&lt;/p&gt;

&lt;p&gt;To prove this. we are going to make some tweaks to our &lt;code&gt;App.js&lt;/code&gt; file by simply changing some text. To see if truly our&lt;br&gt;
changes would be reflected on the live site. once we push to Github.&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;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;SECOND&lt;/span&gt; &lt;span class="nx"&gt;DEPLOYMENT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BREAKING&lt;/span&gt; &lt;span class="nx"&gt;CHANGES&lt;/span&gt; &lt;span class="err"&gt;😊🎉&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/header&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once those changes are made. commit and push your code to Github.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In no time you should see your changes reflect in your Netlify website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620856489994%2FLwsZuoMnt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1620856489994%2FLwsZuoMnt.png" alt="final deployed  app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hurray!&lt;/p&gt;

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

&lt;p&gt;And that is it, guys. we now have a deployed version of our react application, which would be updated whenever we push&lt;br&gt;
our changes to Github.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Thanks so much for reading. hope you wouldn't break a sweat when next you are deploying your react&lt;br&gt;
applications 😅.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Let me know in the comments which free hoisting service you have been using. and maybe I might write&lt;br&gt;
on that.&lt;/p&gt;

&lt;p&gt;What are you still waiting for? 🤷‍♂️. go deploy that react app to Netlify!.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.buymeacoffee.com/molipa" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.buymeacoffee.com%2Fbuttons%2Fv2%2Fdefault-yellow.png" alt="Buy Me A Coffee"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I hope you found this helpful, Thanks so much for reading!! 💖 And keep on coding! 👨‍💻.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>netlify</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
