<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anuraggharat651</title>
    <description>The latest articles on DEV Community by Anuraggharat651 (@anuraggharat651).</description>
    <link>https://dev.to/anuraggharat651</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%2F1071281%2Fc61be652-c78b-4276-aa48-22a3177f3b59.jpeg</url>
      <title>DEV Community: Anuraggharat651</title>
      <link>https://dev.to/anuraggharat651</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anuraggharat651"/>
    <language>en</language>
    <item>
      <title>Mastering CSS Units: A Complete Guide</title>
      <dc:creator>Anuraggharat651</dc:creator>
      <pubDate>Wed, 13 Mar 2024 06:28:29 +0000</pubDate>
      <link>https://dev.to/anuraggharat651/mastering-css-units-a-complete-guide-1ldm</link>
      <guid>https://dev.to/anuraggharat651/mastering-css-units-a-complete-guide-1ldm</guid>
      <description>&lt;p&gt;In today’s world, where the Internet is accessed over various devices with different screen sizes, making the website responsive should be our first priority.&lt;/p&gt;

&lt;p&gt;Responsive web design ensures that your website adapts to every screen size, device type, and browser without sacrificing usability and accessibility. A responsive website enhances the user experience and performance. CSS units play an important role in achieving website responsiveness.&lt;/p&gt;

&lt;p&gt;This blog explores CSS units and all the available ones in CSS. We will look at two categories of CSS units — absolute and relative. Also, we will study each unit from both the categories and their use case scenarios.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Explore top&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/api-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;API testing tools&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;to ensure seamless integration &amp;amp; performance.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a CSS Unit?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/blog/css3-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS&lt;/a&gt;, which stands for Cascading Style Sheets, is a rule-based language used to control the presentation and styling of HTML documents. A CSS file contains multiple CSS rules that specify how all the elements on the webpage are to be styled.&lt;/p&gt;

&lt;p&gt;A CSS rule has three parts: a selector, a property, and a value for that CSS property. Many CSS properties, like width, height, margins, padding, etc., accept a value and a proper unit. If an incorrect unit is passed to a CSS property, that CSS property is discarded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--adperRZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Amr-gsM46hXCSV2lE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--adperRZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Amr-gsM46hXCSV2lE.png" alt="image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Anatomy of a CSS code&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A unit is a standardized quantity used to denote or measure physical quantities. In the real world, we use units like &lt;em&gt;km&lt;/em&gt; or &lt;em&gt;mile&lt;/em&gt; to measure distance, grams or pounds to measure weight, and seconds, minutes, or hours to measure time. In the CSS context, properties like width, height, margin, padding, font size, border, etc., related to sizing or dimensions require a unit.&lt;/p&gt;

&lt;p&gt;A CSS unit is a measurement of length, size, or quantity used to express the amount of quantity for a CSS property. CSS provides plenty of options to work with units, like pixels, centimeters, millimeters, percentages, etc..&lt;/p&gt;

&lt;p&gt;The units in CSS are grouped into two categories.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Absolute units&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Relative units&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the next section, we will explore in detail the different types of CSS units.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article on the Best Automated&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/top-ui-automated-testing-tools/https://www.lambdatest.com/blog/top-ui-automated-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;UI Testing Tools&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;cover what is UI automated testing, challenges while performing UI testing, and top tools that can help you perform UI testing.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to Absolute Units
&lt;/h3&gt;

&lt;p&gt;Absolute CSS units are fixed measurements that do not change based on external factors like screen or browser sizes. These units stay consistent and the same across all device sizes. This means that an element, when set to an absolute value, will remain the same on large desktops and handheld devices.&lt;/p&gt;

&lt;p&gt;Here are some common absolute units in CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pixel Unit (px)
&lt;/h3&gt;

&lt;p&gt;Pixels or &lt;em&gt;px&lt;/em&gt; are the most common absolute length units used in CSS. 1 pixel stands for 1 single dot on the screen. However, don’t confuse the CSS pixel with actual pixels. A CSS pixel is not necessarily equal to one physical screen pixel.&lt;/p&gt;

&lt;p&gt;1 pixel is defined as 1/96 of an inch. But this was defined when the computer monitors had a resolution of 1024×768 px and a DPI( Dots/Pixels per inch) of 96.&lt;/p&gt;

&lt;p&gt;Today, modern computer monitors with the latest high-density screens have a DPI of almost 3 times the old monitors. The same thing applies to mobile phones or any screen-related device. The image below shows a comparison between the 1st generation of iPhone and the latest model (i.e., iPhone 15 Pro) in terms of resolution.&lt;/p&gt;

&lt;p&gt;As you can see, the screens have become denser; hence, 1 pixel of a CSS unit is no longer equal to 1 physical pixel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Svx4qsoO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AoLK-RHsGSg0o5dHL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Svx4qsoO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AoLK-RHsGSg0o5dHL.png" alt="image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To summarize, CSS pixels are logical pixels used to define values for CSS properties, and device pixels are the physical screen pixels. So hereafter, whenever we discuss pixels, we refer to CSS pixels (not physical screen pixels).&lt;/p&gt;

&lt;p&gt;In the below example, we have three texts in &lt;em&gt;&amp;lt; p &amp;gt;&lt;/em&gt; tags with font sizes of &lt;em&gt;16px&lt;/em&gt;, &lt;em&gt;20px&lt;/em&gt; and &lt;em&gt;24px&lt;/em&gt; respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div&amp;gt;
&amp;amp;lt;p style="font-size: 16px;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 20px;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 24px;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aNiucTv4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AhqDjPR9YmRpSDAu2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aNiucTv4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AhqDjPR9YmRpSDAu2.png" alt="image" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pixel unit example 1&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Although the pixel unit is mostly used in font-related properties, we can also use it for specifying widths, heights, margins, paddings, etc. In the example below, we provide a width of &lt;em&gt;800px&lt;/em&gt; and a height of &lt;em&gt;100px&lt;/em&gt; for a &lt;em&gt;&amp;lt; div &amp;gt;&lt;/em&gt; element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div style="width: 800px; 
            height: 100px; 
            background-color: #0ebac5; 
            font-size: 24px;"&amp;gt;
     Width of 800px, height of 100px and font-size of 24px
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SdweqxCI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ACdFvKj-noRsMt29J.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SdweqxCI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ACdFvKj-noRsMt29J.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pixel unit example 2&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pixels (&lt;em&gt;px&lt;/em&gt;) are the most popular and go-to unit while providing measurements in CSS. However, pixel units can present challenges during responsive behavior due to their fixed-size nature. If the provided value exceeds the screen size, the browser will add a scroll bar to fit the content on the page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The best&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/best-test-automation-frameworks/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;test automation frameworks&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;include Selenium, Cypress, Playwright, and Appium. Find more about these top test automation frameworks.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div style="width: 2800px; 
            height: 100px; 
            background-color: #0ebac5; 
            font-size: 24px;"&amp;gt;
     Width of 2800px, height of 100px and font-size of 24px
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---IhmfJ0U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AHXMKKD6k__-q-CU_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---IhmfJ0U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AHXMKKD6k__-q-CU_.png" alt="image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Scrollbar at the bottom due to absolute units&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Inches Unit (in)
&lt;/h3&gt;

&lt;p&gt;In CSS, the inch unit is equivalent to &lt;em&gt;96px&lt;/em&gt;, i.e., &lt;em&gt;1in&lt;/em&gt; = &lt;em&gt;96px&lt;/em&gt;. Similar to pixels, 1 inch in CSS is not equal to 1 physical inch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div&amp;gt;
&amp;amp;lt;p style="font-size: 0.25in;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 0.5in;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 1in;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sP5vDmF2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ANlfdu5G7bTQ-wLN1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sP5vDmF2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ANlfdu5G7bTQ-wLN1.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Inches unit example&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Centimeter Unit (cm)
&lt;/h3&gt;

&lt;p&gt;In CSS, a 1-centimeter unit or &lt;em&gt;1cm&lt;/em&gt; equals 25.2/64 inches or &lt;em&gt;37.8px&lt;/em&gt;. The &lt;em&gt;cm&lt;/em&gt; unit is used to specify length values in centimeters. Similar to pixels, &lt;em&gt;1cm&lt;/em&gt; in CSS is not equal to &lt;em&gt;1cm&lt;/em&gt; in real life.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div&amp;gt;
&amp;amp;lt;p style="font-size: 1cm;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 2cm;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 3cm;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--79EtFnSD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AJvDX-9e_WMZnsQGq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--79EtFnSD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AJvDX-9e_WMZnsQGq.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Centimeter unit example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The best&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/best-test-automation-frameworks/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;automation testing frameworks&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;include Selenium, Cypress, Playwright, and Appium. Find more about these top test automation frameworks.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Millimeter Unit (mm)
&lt;/h3&gt;

&lt;p&gt;The millimeter unit or &lt;em&gt;1mm&lt;/em&gt; is an absolute CSS unit where &lt;em&gt;1mm&lt;/em&gt; equals &lt;em&gt;3.78px&lt;/em&gt; or 1/10 of &lt;em&gt;1 cm&lt;/em&gt;. Generally, the centimeter (&lt;em&gt;cm&lt;/em&gt;) and millimeter (&lt;em&gt;mm&lt;/em&gt;) units are rarely used and have minimal use cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div&amp;gt;
&amp;amp;lt;p style="font-size: 5mm;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 10mm;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 15mm;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uolNenUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A_J-3P-JKT19Wn2vv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uolNenUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A_J-3P-JKT19Wn2vv.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Millimeter unit example&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Quarter Millimeter Unit (q)
&lt;/h3&gt;

&lt;p&gt;A quarter millimeter unit or &lt;em&gt;1q&lt;/em&gt; roughly equals &lt;em&gt;0.944px&lt;/em&gt; or 1/4 of &lt;em&gt;1mm&lt;/em&gt; unit. This is one of the smallest measurements available in CSS and is only used in cases where minute adjustments of spacing (or lengths) are required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div&amp;gt;
&amp;amp;lt;p style="font-size: 10q;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 25q;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 50q;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EJCvNUT7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AljfL3zjjO6Nv_gE_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EJCvNUT7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AljfL3zjjO6Nv_gE_.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Quarter millimeter unit example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Perform live&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/best-test-automation-frameworks/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;web device testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;on different devices with LT Browser 2.0. Test on multiple mobile and tablet viewports and debug UI issues on the go across 50+ device viewports.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Points Unit (pt) and Picas Unit (pc)
&lt;/h3&gt;

&lt;p&gt;Points (&lt;em&gt;pt&lt;/em&gt;) and Picas (&lt;em&gt;pc&lt;/em&gt;) units are two additional units that are used alongside the pixel unit. In CSS, 1 point unit or &lt;em&gt;1pt&lt;/em&gt; is equivalent to &lt;em&gt;1.33px&lt;/em&gt; or 1/72 inch, and 1 picas or &lt;em&gt;1pc&lt;/em&gt; is equivalent to &lt;em&gt;16px&lt;/em&gt; or 1/6 inch. These units are used when precise control over sizing and layout is required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div&amp;gt;
&amp;amp;lt;p style="font-size: 10pt;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 20pt;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 30pt;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gmXnTsQ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Amy-dj7aiIbVSOVQm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gmXnTsQ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Amy-dj7aiIbVSOVQm.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Points unit example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div&amp;gt;
&amp;amp;lt;p style="font-size: 1pc;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 2pc;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 3pc;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tgFtbBw6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AEV7rqW-hmcEq7mtS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tgFtbBw6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AEV7rqW-hmcEq7mtS.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Picas unit example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To summarize,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--74qNHA_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/1%2AJT9dRjKwjkj8bclbd8OXVQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--74qNHA_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/1%2AJT9dRjKwjkj8bclbd8OXVQ.png" alt="image" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Perform live test and&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/test-site-on-mobile?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;view website on different devices&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with LT Browser 2.0. Test on multiple mobile and tablet viewports and debug UI issues on the go across 50+ device viewports.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When to Use Absolute Units?
&lt;/h3&gt;

&lt;p&gt;Absolute CSS units should be considered in cases where an HTML element should carry a fixed size regardless of factors like screen size, orientation, or parent element size. Generally, absolute units are used to denote small fixed values. Here are some use cases where you can consider using absolute units.&lt;/p&gt;

&lt;h3&gt;
  
  
  Printing Stylesheets
&lt;/h3&gt;

&lt;p&gt;CSS has a special rule allowing you to define styles for printing a web page. This rule is a part of the &lt;a href="https://www.lambdatest.com/blog/responsive-css-media-queries-for-responsive-design/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS media queries&lt;/a&gt; rule that conditionally applies or modifies styles when the webpage is printed on paper.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media print {
/* Styles will only be added while printing a web page*/
body {
font-size: 20px;
}
.container{
width: 1000px;
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During the printing process, it is necessary to attain pixel-perfect measurements so that the printed output matches the dimensions of the paper used for printing. Using absolute CSS units like pixels or inches, we can attain maximum accuracy since these units are closest to physical measurements. Hence, as a standard practice, using absolute CSS units while writing styles for web page printing is always recommended.&lt;/p&gt;

&lt;h3&gt;
  
  
  Attaining Pixel Perfect Design
&lt;/h3&gt;

&lt;p&gt;Developers follow a UI design while creating a webpage. These designs are crafted with utmost precision and fixed measurements, which all the developers must follow. Absolute units are ideal for achieving pixel-perfect designs since they specify fixed measurements that don’t change based on external factors.&lt;/p&gt;

&lt;p&gt;Absolute CSS units can also be considered in cases where maintaining &lt;a href="https://www.lambdatest.com/learning-hub/responsive-design?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive design&lt;/a&gt; is not a requirement. For example, while building desktop apps that only run on a single device with fixed dimensions that cannot be resized. Since the app does not change dimensions, we can use absolute units to define the size of elements to attain a pixel-perfect design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Simplify your work with our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/decimal-to-bcd?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Decimal to BCD&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter. Accurately convert decimal numbers to binary-coded decimal values quickly and easily! Try it now and simplify your work.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sizing of Images and Icons
&lt;/h3&gt;

&lt;p&gt;Along with textual content, the webpage comprises multimedia items like images, SVGs, icons, etc. In most cases, these assets don’t scale the same way as other elements. These assets have a fixed set of measurements that must be followed per the screen size. In such cases, using absolute CSS units, we can specify a fixed sizing and position of icons or images so that they don’t stretch or compress when the webpage is resized.&lt;/p&gt;

&lt;p&gt;In the below example, we have styled a logo using absolute units. We have placed it at the top left and provided sizing using pixel measurements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;body&amp;gt;
&amp;amp;lt;nav
style="background-color: #dfdfdf;
position: relative;
height: 150px;"&amp;gt;
&amp;amp;lt;img
style="position: fixed;
width: 200px;
height: 50px;
top: 50px;
left: 50px;"
src="https://www.lambdatest.com/resources/images/logos/logo.svg"
&amp;gt;

&amp;amp;lt;/nav&amp;gt;

&amp;amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SwT_PAd1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AijD5I6Lo_9iGGcDG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SwT_PAd1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AijD5I6Lo_9iGGcDG.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Styling logo using absolute CSS units&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Specifying Small Spacing and Lengths
&lt;/h3&gt;

&lt;p&gt;One of the most useful use cases of absolute units is to provide specific &lt;a href="https://www.lambdatest.com/blog/css-spacing-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS spacing&lt;/a&gt; while providing margins and paddings. Margins and padding properties in CSS require exact values to keep the entire design consistent.&lt;/p&gt;

&lt;p&gt;Also, absolute CSS units make fine-tuning spacing easier since we get a wide range of units to make even the smallest adjustments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div{
margin: 1px 0.5px;
padding: 1.5px;
border: 1cm solid red;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Decode UTF8 encoded data with ease using our online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/utf8-decode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;UTF8 Decode&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool now and simplify your workflow! Decode your data quickly and accurately.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When to Avoid Using Absolute Units?
&lt;/h3&gt;

&lt;p&gt;Absolute units provide fixed values that do not change based on screen sizes. Hence, this fixed nature makes it difficult to maintain responsiveness across all screens. For example, in the below output, we have an image with a width of &lt;em&gt;1000px&lt;/em&gt; and a height of &lt;em&gt;800px&lt;/em&gt;. On displays larger than &lt;em&gt;1000px,&lt;/em&gt; the image will be shown properly on the screen. But on devices with screen sizes less than &lt;em&gt;1000px&lt;/em&gt;, only a part of the image will be visible, and a horizontal scrollbar will be added to fit the image on the screen.&lt;/p&gt;

&lt;p&gt;Using absolute CSS units should be avoided when measuring relative to external factors such as device viewports, parent elements, and default browser settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C4fy4Cut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A0ehElemfl2TqBbkn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C4fy4Cut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A0ehElemfl2TqBbkn.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Image shown properly on large screens&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lq2ELuqK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A3odDybow0sfxNS0w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lq2ELuqK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A3odDybow0sfxNS0w.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Image cropped on small screen&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to Relative Units
&lt;/h3&gt;

&lt;p&gt;The relative units are measured in relation to external criteria such as parent element size, viewports, browser default size, etc. Relative units are calculated units that are calculated values that are calculated during the layout operation of the website. The browser uses inheritance and cascading rules to arrive at the final value. Relative units fluctuate as external factors such as viewport size and parent element change.&lt;/p&gt;

&lt;p&gt;Here are some common relative CSS units:&lt;/p&gt;

&lt;h3&gt;
  
  
  EM Unit (em)
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;em&lt;/em&gt; unit is a popular relative unit used mainly for specifying lengths for font-related properties in CSS. &lt;em&gt;em&lt;/em&gt; units are calculated based on the font size of the parent element. The &lt;em&gt;em&lt;/em&gt; unit inherits the value of the parent element. Let’s understand this with the help of the example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;amp;lt;div style="font-size: 16px;"&amp;gt;
&amp;amp;lt;p style="font-size: 1em;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;p style="font-size: 2em;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;amp;lt;/p&amp;gt;
&amp;amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--75QjpyYr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A4F1QkJ3JuEw0h5a2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--75QjpyYr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A4F1QkJ3JuEw0h5a2.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example, the parent &lt;em&gt;div&lt;/em&gt; element has a font size of &lt;em&gt;16rem&lt;/em&gt;, and two children &lt;em&gt;&amp;lt; p &amp;gt;&lt;/em&gt; elements have a font size of &lt;em&gt;1em&lt;/em&gt; and &lt;em&gt;2em&lt;/em&gt; respectively. Hence, the computed value for these child &lt;em&gt;&amp;lt; p &amp;gt;&lt;/em&gt; tags will be&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1em&lt;/em&gt; = 1 X font-size of parent = 1 X &lt;em&gt;16px&lt;/em&gt; = &lt;em&gt;16px&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2em&lt;/em&gt; = 2 X font-size of parent = 2 X &lt;em&gt;16px&lt;/em&gt; = &lt;em&gt;32px&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To cross-check if the computed values are working correctly we can open the Chrome DevTools and click on the &lt;em&gt;&amp;lt; p &amp;gt;&lt;/em&gt; element. Move to the computed styles tab to open the styles for &lt;em&gt;&amp;lt; p &amp;gt;&lt;/em&gt; tag. You can find the style applied to the selected element.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Oi7bqo9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AvACNXpuhabLW5sLS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Oi7bqo9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AvACNXpuhabLW5sLS.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;em unit example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ChR7_o8u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A1aIy8Pr54dchYAiZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ChR7_o8u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A1aIy8Pr54dchYAiZ.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;em unit example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to encode your text into UTF-8 format? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/utf8-encode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;UTF-8 Encode&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool to encode your text for seamless communication across all platforms and devices. Try it for free today.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  REM Unit (rem)
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;rem&lt;/em&gt; unit, also called the root &lt;em&gt;em&lt;/em&gt; unit, is an &lt;em&gt;em&lt;/em&gt; counterpart. Instead of inheriting the value from the parent, the value is inherited from the root element, i.e., &lt;em&gt;&amp;lt; html &amp;gt;&lt;/em&gt; element. Similar to &lt;em&gt;em&lt;/em&gt;, the computed value is based on the value set to the root element in CSS. If no value is set to the root element, CSS uses the browser’s default values to calculate the computed values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;html{
  font-size: 24px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div style="font-size: 16px;"&amp;gt;
&amp;lt;p style="font-size: 1rem;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;lt;/p&amp;gt;
&amp;lt;p style="font-size: 2rem;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zY_4x9RM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AAn1xhGjXoT71ZBfW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zY_4x9RM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AAn1xhGjXoT71ZBfW.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example, we have a root element &lt;em&gt;&amp;lt; html &amp;gt;&lt;/em&gt; with a font size of 24px and parent &lt;em&gt;&amp;lt; div &amp;gt;&lt;/em&gt; with font size of 16px. Inside the parent element, we have 2 child paragraph elements &lt;em&gt;&amp;lt; p &amp;gt;&lt;/em&gt; with font sizes of &lt;em&gt;1rem&lt;/em&gt; and &lt;em&gt;2rem&lt;/em&gt;, respectively. Since we use &lt;em&gt;rem&lt;/em&gt; instead of em, the final value is calculated based on root element sizing. Hence, the computed value of the font size property of p tags is as follows:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1rem&lt;/em&gt; = 1 X font-size of root = 1 X 24 = &lt;em&gt;24px&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2rem&lt;/em&gt; = 2 X font-size of root = 2 X 24 = &lt;em&gt;48px&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qrxi2SF5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ANu3-Fk2HExML6jq5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qrxi2SF5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ANu3-Fk2HExML6jq5.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;rem unit example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M_l-QIn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AV8gRCD4c2VokDJyF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M_l-QIn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AV8gRCD4c2VokDJyF.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;rem unit example&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  CH Unit (ch)
&lt;/h3&gt;

&lt;p&gt;In CSS, the &lt;em&gt;ch&lt;/em&gt; unit stands for character unit. A &lt;em&gt;ch&lt;/em&gt; unit in CSS is defined as the width of the character ‘0’ of the font. So, a width of &lt;em&gt;10ch&lt;/em&gt; will be equal to the width of 10 ‘0’ characters of the font used on the website. This unit is useful when the requirement is to size an element based on the width of the characters of the font.&lt;/p&gt;

&lt;p&gt;One important point to remember is the &lt;em&gt;ch&lt;/em&gt; unit will change if the font of the element is changed since the size of the character ‘0’ does not stay the same in all the fonts.&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&amp;gt;
&amp;lt;p style="font-size: 50px;
width: 10ch;
background-color: aqua;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;lt;/p&amp;gt;


&amp;lt;p style="font-size: 50px;
width: 10ch;
background-color: aqua;"&amp;gt;
0000000000
&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6PZP76wI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Ab0cGAn10rP63jJDe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6PZP76wI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Ab0cGAn10rP63jJDe.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ch unit example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to convert&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/convert-hex-color-to-rgb?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Hex to RGB&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;values? Use our Hex color to RGB Converter tool to convert Hex colors to RGB values — it’s fast, free, and accurate. Try it now for hassle-free conversions.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  EX Unit (ex)
&lt;/h3&gt;

&lt;p&gt;ex stands for x-height unit in CSS. An &lt;em&gt;ex&lt;/em&gt; unit in CSS is defined as the height of the lowercase character ‘x’ measured from the baseline. Similar to &lt;em&gt;ch&lt;/em&gt;, &lt;em&gt;ex&lt;/em&gt; is also relative since the height of character ‘x’ changes based on the font.&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&amp;gt;
&amp;lt;p style="font-size: 50px;
height: 5ex;
background-color: aqua;"&amp;gt;
Next-Generation Mobile Apps and Cross Browser Testing cloud
&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KQfYc9RV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ActxsRpCti1jqO4lb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KQfYc9RV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ActxsRpCti1jqO4lb.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ex unit example&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Device Viewport Unit (vw and vh)
&lt;/h3&gt;

&lt;p&gt;Device viewport units consist of two different units, &lt;em&gt;vw&lt;/em&gt; (view width) and &lt;em&gt;vh&lt;/em&gt; (view height). &lt;em&gt;1vw&lt;/em&gt; is equal to 1% of the viewport width. Similarly, &lt;em&gt;1vh&lt;/em&gt; is equal to 1% of the viewport height. So if a device has a viewport of 1920 X 1080 pixels (width X height), then &lt;em&gt;1vh&lt;/em&gt; = 108 pixels and &lt;em&gt;1vw&lt;/em&gt; = 192 pixels.&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 style="height: 20vh; width: 100vw; background-color: beige;"&amp;gt;
DIV1 width=100vw and height=20vh
&amp;lt;/div&amp;gt;


&amp;lt;div style="height: 20vh; width: 50vw; background-color: aqua;"&amp;gt;
DIV2 width=50vw and height=20vh
&amp;lt;/div&amp;gt;


&amp;lt;div style="height: 20vh; width: 25vw; background-color: burlywood;"&amp;gt;
DIV3 width=25vw and height=20vh
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WNeQr340--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A9bVAOtd48Hb3cucN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WNeQr340--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A9bVAOtd48Hb3cucN.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Viewport units on large screen&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the above example of &lt;a href="https://www.lambdatest.com/blog/css-viewport-units/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS viewport units&lt;/a&gt;, we have created three div containers with a width of &lt;em&gt;100vw&lt;/em&gt;, &lt;em&gt;50vw&lt;/em&gt;, and &lt;em&gt;25vw&lt;/em&gt; respectively, and a height of &lt;em&gt;20vh&lt;/em&gt;. These measurements will change when the screen is resized.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VcrEoGGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AA6KZ-vrNZ0hFXl2D.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VcrEoGGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AA6KZ-vrNZ0hFXl2D.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Viewport units on small screen&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Device Viewport Maximum and Minimum Units (vmax, vmin)
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;vmin&lt;/em&gt; and &lt;em&gt;vmax&lt;/em&gt; units are based on the values of &lt;em&gt;vw&lt;/em&gt; and &lt;em&gt;vh&lt;/em&gt;. By definition, in CSS, &lt;em&gt;1vmin&lt;/em&gt; is 1% of the viewport’s smallest dimensions, and &lt;em&gt;1vmax&lt;/em&gt; is 1% of the viewport’s largest dimensions. For example, if a browser is 1000 pixels in width and 600 pixels in height, then &lt;em&gt;1vmin&lt;/em&gt; is equal to &lt;em&gt;6px&lt;/em&gt; since 600 pixels &amp;lt; 1000 pixels. Similarly, &lt;em&gt;1vmax&lt;/em&gt; is equal to &lt;em&gt;10px&lt;/em&gt; since 1000 pixels &amp;gt; 600 pixels.&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 style="height: 10vmax; width: 50vmin; background-color: beige;"&amp;gt;
height=10vmax and width=50vmin
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6geS5vOa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AjxqyYSzvv5wqT7Mw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6geS5vOa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AjxqyYSzvv5wqT7Mw.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Min/Max viewport units on large screen&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;vmin&lt;/em&gt; and &lt;em&gt;vmax&lt;/em&gt; units are extremely helpful when the device’s orientation is changed. In such cases, the values for &lt;em&gt;vmin&lt;/em&gt; and &lt;em&gt;vmax&lt;/em&gt; are automatically changed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Device Percentage Unit (%)
&lt;/h3&gt;

&lt;p&gt;Percentage unit &lt;em&gt;(%)&lt;/em&gt; is a relative unit calculated based on the parent element’s size. For example, if the width of a parent &lt;em&gt;&amp;lt; div &amp;gt;&lt;/em&gt; element is &lt;em&gt;400px&lt;/em&gt; and the width of a child div inside the parent div is set to &lt;em&gt;50%&lt;/em&gt;. Then, the width of the child &lt;em&gt;&amp;lt; div &amp;gt;&lt;/em&gt; will be &lt;em&gt;200px&lt;/em&gt; since &lt;em&gt;50%&lt;/em&gt; of 400 is 200.&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 style="width: 400px; height: 400px; background-color: bisque;"&amp;gt;
     &amp;lt;div style="width: 50%; height: 50%; background-color: aqua;"&amp;gt;
     &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hAkbjaq4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AaURoBTfooSg8IWpl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hAkbjaq4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AaURoBTfooSg8IWpl.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;percentage units example&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Percentage units work with all kinds of CSS properties like fonts, borders, etc., but are mostly used while creating responsive layouts. Here’s an example of a responsive 3-column layout using percentage units.&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 style="display: flex;
flex-direction: row;
justify-content: start;
width: 100vw;
height: 100vh;
background-color: beige;"&amp;gt;
&amp;lt;div style="width: 33.33%;
height: 100%;
background-color: tomato;"&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div style="width: 33.33%;
height: 100%;
background-color: blue;"&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div style="width: 33.33%;
height: 100%;
background-color: yellow;"&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VQAVYrGi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ADt_7yebfEiaevhEW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VQAVYrGi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ADt_7yebfEiaevhEW.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;3-column layout using percentage unit&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To summarize relative units,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T3abVqJq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/1%2AB_A5Nps8wRUESuacB0YetQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T3abVqJq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/1%2AB_A5Nps8wRUESuacB0YetQ.png" alt="image" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When to Use Relative Over Absolute CSS Units?
&lt;/h3&gt;

&lt;p&gt;Here are a few cases where we can consider using Relative units over Absolute units.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to decode an encoded URL? Our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/url-decode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;URL Decode&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool can help to decode any encoded URL. Fast, simple, and reliable, Try it now.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Responsive Web Design
&lt;/h3&gt;

&lt;p&gt;The most important use case of relative units is responsive web design. It is possible to size the HTML elements using relative CSS units based on the parent of device dimensions. This makes it easy to change sizing based on screen size.&lt;/p&gt;

&lt;p&gt;Previously, we discussed how using Absolute units for images causes issues with responsive web design. Let’s fix this problem using Relative units.&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;img
src="https://www.lambdatest.com/resources/images/icons/banner1.webp"
style="width: 80%; 
height: auto;"
&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BL6dzN5c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AXvq8ausBHRnytmVc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BL6dzN5c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AXvq8ausBHRnytmVc.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Responsive image on large screen&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MDi2pa4I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AAQ7zJ1-dzK58VGWC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MDi2pa4I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2AAQ7zJ1-dzK58VGWC.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Responsive image on small screen&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Relative units like &lt;em&gt;vw&lt;/em&gt;, &lt;em&gt;vh&lt;/em&gt;, and &lt;em&gt;%&lt;/em&gt;, along with CSS media queries, can be used to create responsive and flexible web pages.&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset="UTF-8"&amp;gt;
&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
&amp;lt;title&amp;gt;
CSS Units
&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;style&amp;gt;
*{
box-sizing: border-box;
padding: 0;
margin: 0;
}
body{
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
min-height: 100vh;
}
.parent{
display: flex;
flex-direction: row;
justify-content: start;
width: 100vw;
height: 100vh;
background-color: beige;
}
.child1{
width: 33.33%;
height: 100%;
background-color: tomato;
}
.child2{
width: 33.33%;
height: 100%;
background-color: blue;
}
.child3{
width: 33.33%;
height: 100%;
background-color: yellow;
}
@media only screen and (max-width: 600px) {
.child1,.child2,.child3{
width: 100%;
height: 33.33%;
}
.parent{
flex-direction: column;
}
}


&amp;lt;/style&amp;gt;
&amp;lt;body&amp;gt;


&amp;lt;div class="parent"&amp;gt;
&amp;lt;div class="child1"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div class="child2"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div class="child3"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;




&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Responsive 3-column layout using relative units&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Font Sizing
&lt;/h3&gt;

&lt;p&gt;Relative units like &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; are perfect for specifying size for font-related properties. Since these units are related to the parent or root element’s size, they allow the font to scale and adapt if the screen is resized. Since &lt;em&gt;em&lt;/em&gt; and &lt;em&gt;rem&lt;/em&gt; are directly related to the root or parent element, the text using these values remains readable even when the screen size changes.&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;p style="font-size: 100px;"&amp;gt;Text with 100px font-size&amp;lt;/p&amp;gt;
&amp;lt;p style="font-size: 2rem;"&amp;gt;Text with 2rem font-size&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wIC3LhON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ARpvXL4oElI3wfd8X.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wIC3LhON--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2ARpvXL4oElI3wfd8X.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Responsive text on large screen&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8SfWVq9i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A6oIghydSnHSPQzhX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8SfWVq9i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A6oIghydSnHSPQzhX.png" alt="image" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Responsive text on small screen&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Layouts
&lt;/h3&gt;

&lt;p&gt;Using relative CSS units like &lt;em&gt;%&lt;/em&gt;, &lt;em&gt;vh&lt;/em&gt;, and &lt;em&gt;vw&lt;/em&gt;, creating layouts is quick and easy. It is super simple to create fluid designs where the size of the child element is set based on the parent element. These layouts stay responsive and adapt when the screen is resized.&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset="UTF-8"&amp;gt;
&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
&amp;lt;title&amp;gt;
CSS Units
&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;style&amp;gt;
*{
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
body{
min-height: 100vh;
}
div{
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
font-size: 20px;
}
img{
   width: 50%;
}
.parent{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: start;
width: 100vw;
height: 100vh;
}
.child1{
padding: 10px;
width: 100%;
height: 20%;
font-size: 30px;
background-color: aqua;
}
.child2{
padding: 10px;
width: 20%;
height: 80%;
background-color: beige;
}
.child3{
padding: 10px;
width: 30%;
height: 80%;
background-color: lightcyan;
}
.child4{
flex-direction: column;
width: 50%;
height: 80%;
}
.grandchild1{
padding: 10px;
width: 100%;
height: 50%;
background-color: tomato;
}
.grandchild2{
padding: 10px;
width: 100%;
height: 50%;
background-color: yellow;
}
@media only screen and (max-width: 600px) {
.parent{
flex-direction: column;
}
.child1{
width: 100%;
height: 10%;
}
.child2{
width: 100%;
height: 60%;
}
.child3{
width: 100%;
height: 20%;
}
.child4{
width: 100%;
height: 10%;
flex-direction: row;
}
.grandchild1,.grandchild2{
height: 100%;
width: 50%;
}


}
&amp;lt;/style&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class="parent"&amp;gt;
&amp;lt;div class="child1"&amp;gt;
LambdaTest
&amp;lt;/div&amp;gt;
&amp;lt;div class="child2"&amp;gt;
&amp;lt;ul&amp;gt;
   &amp;lt;li&amp;gt;Live Testing&amp;lt;/li&amp;gt;
   &amp;lt;li&amp;gt;Automated Testing&amp;lt;/li&amp;gt;
   &amp;lt;li&amp;gt;Mobile Testing&amp;lt;/li&amp;gt;
   &amp;lt;li&amp;gt;HyperExecute Testing&amp;lt;/li&amp;gt;
   &amp;lt;li&amp;gt;Visual Regression Cloud&amp;lt;/li&amp;gt;
   &amp;lt;li&amp;gt;AI Powered Test Analytics&amp;lt;/li&amp;gt;
   &amp;lt;li&amp;gt;Smart TV Testing&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class="child3"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud
&amp;lt;/div&amp;gt;
&amp;lt;div class="child4"&amp;gt;
&amp;lt;div class="grandchild1"&amp;gt;
   &amp;lt;img src="https://www.lambdatest.com/resources/images/selenium-parallel-testing-index.png" alt=""&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class="grandchild2"&amp;gt;
   &amp;lt;img src="https://www.lambdatest.com/resources/images/selenium-parallel-testing-index.png" alt=""&amp;gt;
&amp;lt;/div&amp;gt;


&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;


&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For checking the layout on various screen sizes we will use LT Browser from LambdaTest. &lt;a href="https://www.lambdatest.com/lt-browser?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;LT Browser&lt;/a&gt; is a free, Chromium-based desktop application designed specifically for web developers to help them build, test, and debug their websites and web applications, particularly for mobile responsiveness.&lt;/p&gt;

&lt;p&gt;It supports 53+ multiple device viewports of varying screen sizes to test the responsiveness of a website. We will use this browser to check how our responsive web page performs on all screen sizes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eAD2OE_M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A5U_KB1zhKXHuTMLB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eAD2OE_M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2A5U_KB1zhKXHuTMLB.png" alt="image" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Complex layout on large screens using relative units&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1A-LEsTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Aez7sHgk8fdmZfJs1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1A-LEsTb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1200/0%2Aez7sHgk8fdmZfJs1.png" alt="image" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Complex layout on small screens using relative units&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Handling responsiveness using relative units&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Check out this tutorial to explore different features of LT Browser that you can use to test responsive web designs.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/rqFeuaZ-wAY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Subscribe to our &lt;a href="https://www.youtube.com/c/LambdaTest?sub_confirmation=1"&gt;LambdaTest YouTube Channel&lt;/a&gt; for the latest updates on tutorials around &lt;a href="https://www.lambdatest.com/mobile-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;mobile app testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/real-device-cloud?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;real device cloud&lt;/a&gt;, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to Avoid Using Relative Units?
&lt;/h3&gt;

&lt;p&gt;It is best not to use relative units when small measurements and adjustments are required. Since relative CSS units keep changing, it is difficult to attain consistency. Also, in some cases, old browsers may not fully support relative units. In such cases, we can choose relative units and add absolute units as a fallback.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Keep your data safe and secure by using our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/base64-encode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=mar_13&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Base64 Encoder&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;. With our tool, you can easily convert any type of data into a secured Base64 string. Try it now.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;That’s all for the blog. I hope you liked the blog and learned about CSS units. We discussed briefly all the popular units in CSS, along with examples.&lt;/p&gt;

&lt;p&gt;We understood the right use case for each unit and when it should be avoided. It’s very unlikely that you would ever need to use all the CSS units, but knowing all the available options makes it easier to choose the best one for the job. Every unit type has its own use case and works like a charm if used correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Happy Coding!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>softwaretesting</category>
      <category>automationtesting</category>
    </item>
    <item>
      <title>Introduction to Tailwind CSS: A Complete Guide</title>
      <dc:creator>Anuraggharat651</dc:creator>
      <pubDate>Wed, 27 Dec 2023 06:05:29 +0000</pubDate>
      <link>https://dev.to/anuraggharat651/introduction-to-tailwind-css-a-complete-guide-461o</link>
      <guid>https://dev.to/anuraggharat651/introduction-to-tailwind-css-a-complete-guide-461o</guid>
      <description>&lt;p&gt;Businesses always look for new ways to improve their online presence. Having a good website is important for this. Making websites work better, load faster on all devices, and easier to build are big goals. Hence, there is a constant search for solutions to replace the outdated mainstream approach and bring products to meet this dynamic market.&lt;/p&gt;

&lt;p&gt;Websites play a pivotal part in establishing a strong online presence for businesses. Consequently, enhancing website performance, making them responsive, and streamlining their development process have become crucial objectives.&lt;/p&gt;

&lt;p&gt;CSS is a crucial element for web development in making websites visually appealing. However, managing long lines of CSS code, maintaining it over time, and handling &lt;a href="https://www.lambdatest.com/learning-hub/responsive-design?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive design&lt;/a&gt; can often pose challenges. That’s why CSS frameworks were introduced. Tailwind CSS is a new-age CSS framework for rapidly building modern websites by eliminating the traditional CSS writing process from scratch.&lt;/p&gt;

&lt;p&gt;Before CSS frameworks were introduced, writing CSS was a time-consuming process. Developers had to write every CSS rule from scratch and maintain these rules and properties over time. As codebases expanded, &lt;a href="https://www.lambdatest.com/blog/css-refactoring/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;refactoring CSS&lt;/a&gt; and optimizing it became challenging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/blog/best-css-frameworks/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS frameworks&lt;/a&gt; solved this problem by eliminating the need to write CSS code manually. CSS frameworks provided ready-to-use component classes that developers could directly plug into their HTML code. This sped up the development process since writing anything from scratch was unnecessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Elevate the app testing process from these 12 best&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/mobile-app-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;mobile automation testing tools&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;. Our comprehensive list includes top-performing tools for achieving excellence. Learn more here.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, these frameworks did come with design constraints. Each of these frameworks included predefined components and styles. Developers had to work within the guidelines and design system provided by the frameworks. Hence, any website built using these frameworks would appear the same.&lt;/p&gt;

&lt;p&gt;The level of customization and control for the developers was very low. If developers needed to customize, they had to overwrite the existing styling with new styles, which was not easy. As a result, a new kind of framework called Tailwind CSS became popular among developers.&lt;/p&gt;

&lt;p&gt;Tailwind is a utility-based CSS framework used for building websites quickly. Tailwind operates differently than the existing frameworks in the market. Instead of giving fixed component-based classes, it provides utility-based classes that developers can use to style their web pages from scratch. With Tailwind, developers are not restricted to any styles; they are free to style however they want. It’s like &lt;em&gt;Writing CSS without actually writing CSS&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WiYMb1PS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A-gVgGR-qbepYdgvF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WiYMb1PS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A-gVgGR-qbepYdgvF.png" alt="image" width="800" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://iknowthatnow.com/wp-content/uploads/2022/08/FoundationCSS-BootstrapCSS-TailwindCSS-scaled.webp"&gt;&lt;em&gt;Source&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As seen in the graph above, Tailwind’s download numbers significantly increased between 2021 and 2022. If we talk about weekly downloads, Tailwind currently stands at 6M+ weekly downloads, more than Bootstrap’s 5.4M downloads, making it the market leader. It’s surprising to learn that a year ago, downloads of Tailwind were only around one-third of what they are now. This is clear evidence of how rapidly the popularity of Tailwind CSS has expanded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AQGWxx3K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Abt0AV52kbyJhM9Ys.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AQGWxx3K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Abt0AV52kbyJhM9Ys.png" alt="image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Bootstrap weekly downloads&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kYI-y7NW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AS7osm0u7A3ShsoA4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kYI-y7NW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AS7osm0u7A3ShsoA4.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tailwind CSS weekly downloads&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this blog, we will explore Tailwind CSS and how it differs from other frameworks. We will also learn how to use the wide variety of classes Tailwind offers. After that, we will build a Developer Portfolio website by applying our newfound Tailwind expertise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article on the Best&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/top-ui-automated-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;UI Automated Testing Tools&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;cover what is UI automated testing, challenges while performing UI testing, and top tools that can help you perform UI testing.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Tailwind CSS?
&lt;/h3&gt;

&lt;p&gt;Tailwind is a utility-first CSS framework comprising single-purpose utility classes that can be used to style an HTML webpage. In contrast to other frameworks, Tailwind doesn’t come with predefined CSS component classes. Instead, it consists of CSS utility or helper classes resembling CSS properties. Tailwind covers almost all the CSS properties in the form of utility classes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lFYdIkV3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/olgpqq2x4q0gj8z2473u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lFYdIkV3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/olgpqq2x4q0gj8z2473u.png" alt="Image" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;By combining multiple utility classes, we can create any component from scratch. Using variations of the same utility class, we can further fine-tune the styles to match the design requirements. In short, it provides you with all the building blocks to create your own components.&lt;/p&gt;

&lt;p&gt;Consider Tailwind as a vast collection of CSS classes, each of which is set up with a single CSS attribute. Use a class from this sizable CSS file to apply a CSS style. For instance, all we need to do to bold a text is add the class of &lt;em&gt;.font-bold&lt;/em&gt; to our HTML element. Tailwind CSS automatically creates a class with the name &lt;em&gt;.font-bold&lt;/em&gt; for us with the CSS attribute &lt;em&gt;font-weight: bold;&lt;/em&gt; it is inside our CSS output file. Tailwind allows us to use all the CSS properties without writing any CSS code ourselves.&lt;/p&gt;


&lt;blockquote&gt;
&lt;p&gt;Tailwind CSS is like writing CSS, without actually writing CSS!✅&lt;/p&gt;— Anurag (@anurag_gharat) &lt;a href="https://twitter.com/anurag_gharat/status/1662101208298065920?ref_src=twsrc%5Etfw"&gt;May 26, 2023&lt;/a&gt;
&lt;/blockquote&gt;  

&lt;p&gt;Since Tailwind became popular among the developer community, eCommerce giants like Shopify and new-age startups like Lemon Squeezy have incorporated it into their web design. Some organizations that use Tailwind CSS are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shopify&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MPKeAs89--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABa-lYDa7sezCDpAm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MPKeAs89--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABa-lYDa7sezCDpAm.png" alt="image" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.shopify.com/in"&gt;&lt;em&gt;Shopify&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OpenAI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oGnVOctQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Adg3f1AqBFvYHKR_2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oGnVOctQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Adg3f1AqBFvYHKR_2.png" alt="image" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openai.com/"&gt;&lt;em&gt;Open AI&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lemon Squeezy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T2iJXLTF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2An1-CZREh5a5ZtKxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T2iJXLTF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2An1-CZREh5a5ZtKxg.png" alt="image" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lemonsqueezy.com/"&gt;&lt;em&gt;Lemon Squeezy&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Netflix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--44LzhzBx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2c7J832DuCfw7z9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--44LzhzBx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2c7J832DuCfw7z9t.png" alt="image" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.netflix.com/tudum/top10/"&gt;&lt;em&gt;Netflix&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Loom&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T7DTZ9Um--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AIWd4Qa5aqDLkuK3R.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T7DTZ9Um--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AIWd4Qa5aqDLkuK3R.png" alt="image" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.loom.com/"&gt;&lt;em&gt;Loom&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Aon5PziG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A6Mbr4sQssr0vw-KF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Aon5PziG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A6Mbr4sQssr0vw-KF.png" alt="image" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.theverge.com/"&gt;&lt;em&gt;Verge&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Generally, CSS frameworks can be divided into two groups based on their nature.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Utility-based frameworks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Component-based frameworks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This blog lists down the best&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/best-android-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;Android testing tools&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;to automate mobile app testing and ensure compatibility across different browsers, devices, and OS.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Utility-based framework
&lt;/h3&gt;

&lt;p&gt;In a utility-based framework, each class is a single-purpose utility class that handles one primary CSS property. The name of the class also resembles the property that it carries. For example, a &lt;em&gt;.flex-row&lt;/em&gt; class will have only one CSS property assigned to it, which is &lt;em&gt;flex-direction: row&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Popular websites like Kickstarter, Clubhouse, and Medium use their utility-based CSS framework, which fits their brand design style.&lt;/p&gt;
&lt;h3&gt;
  
  
  Component-based framework
&lt;/h3&gt;

&lt;p&gt;In the component-based framework, most classes carry the names of components like cards, navbar, footer, etc. This means a &lt;em&gt;.card&lt;/em&gt; CSS class will contain CSS properties like border, background color, padding, etc., making it look like a card.&lt;/p&gt;

&lt;p&gt;Many brands have their in-house CSS component framework built while keeping their brand design system in mind. Organizations like Forbes, Udemy, Spotify, and Walmart use their own CSS component framework.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;In this Selenium with Java tutorial, you will learn everything you need to know to kick start your journey in Selenium&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/selenium-with-java/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;Java automation testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Features of Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;Tailwind stands out in web development with its unique features, making it a preferred choice for developers seeking efficiency and flexibility in their projects. Here are some key features of Tailwind.&lt;/p&gt;
&lt;h3&gt;
  
  
  Utility First Fundamentals
&lt;/h3&gt;

&lt;p&gt;As discussed earlier, Tailwind follows the utility’s first fundamentals. Every class in Tailwind is a utility class for a single CSS property. Each class has a single responsibility and acts as a building block for creating websites.&lt;/p&gt;

&lt;p&gt;With the help of such classes, it is possible to style a component from scratch without writing any CSS. The only downside of this approach is that the HTML elements will look crowded because of multiple class names. The table below shows one of the important Tailwind classes and their corresponding CSS properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4WVXYZbz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AIzaJbXwTBPnwTXCI0plkCw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4WVXYZbz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AIzaJbXwTBPnwTXCI0plkCw.png" alt="image" width="622" height="209"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Classes for Interactions and Element States
&lt;/h3&gt;

&lt;p&gt;Along with utility classes, Tailwind has numerous modifiers like &lt;em&gt;.bg: , .dark: , .md:&lt;/em&gt; etc. which can be used as a prefix for applying conditional classes. One such set of modifiers is used to apply styles based on the element’s current state or user interactions.&lt;/p&gt;

&lt;p&gt;For example, a &lt;em&gt;.bg-black&lt;/em&gt; will set the background color as back for an element, but &lt;em&gt;hover:bg-black&lt;/em&gt; will only set the background color as black when the user hovers the cursor over the element. We will learn more about such interactions later in this blog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2UZ0Rk6n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2ABo46Urx6fpEdaK-0lqkx1Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2UZ0Rk6n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2ABo46Urx6fpEdaK-0lqkx1Q.png" alt="image" width="715" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Get started with this complete&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/selenium?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;automation testing using selenium&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tutorial. Learn what Selenium is, its architecture, advantages and more for automated cross browser testing. Read more.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Customizing Styles
&lt;/h3&gt;

&lt;p&gt;Tailwind already provides us the freedom to style the website as we want. But in some situations, the already preconfigured styles require more customization. In such cases, we can make use of the &lt;em&gt;tailwind.config.js&lt;/em&gt; file. This is a configuration file provided by Tailwind to change the values of the existing classes.&lt;/p&gt;

&lt;p&gt;For example, we can change the value of the blue color(&lt;em&gt;.bg-blue&lt;/em&gt;), or we can even change the breakpoint values for screen modifiers(&lt;em&gt;.lg:&lt;/em&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [],
theme: {
        extend: {},
        },
    plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will see how we can customize and extend Tailwind later in a separate section.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dark Mode
&lt;/h3&gt;

&lt;p&gt;In recent times, dark mode has surged in popularity, becoming a must-have feature for websites and apps. Due to this, many designers and developers now make a dark version of the website and app along with the default design. Dark mode in Tailwind is implemented using utility classes. Using the &lt;em&gt;dark:&lt;/em&gt; prefix, we can now write conditional classes that will only be applied if the color schema of the browser is set to dark mode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e4eM-8Xk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Athhs8BX5XRekvW4TdZmMhQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e4eM-8Xk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Athhs8BX5XRekvW4TdZmMhQ.png" alt="image" width="700" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Responsiveness Across All Screen Sizes
&lt;/h3&gt;

&lt;p&gt;Tailwind CSS uses the &lt;a href="https://www.lambdatest.com/blog/mobile-first-design/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;mobile-first approach&lt;/a&gt; for its utility classes, which means it prioritizes the experience of mobile users over desktop users. A general and common approach is to write CSS styles for large devices first and then modify them using &lt;a href="https://www.lambdatest.com/blog/responsive-css-media-queries-for-responsive-design/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;media queries&lt;/a&gt; for smaller devices.&lt;/p&gt;

&lt;p&gt;But in the mobile-first approach, we write styles for smaller devices first and then use media queries to modify these styles for larger devices. In Tailwind, all the classes target all screen sizes by default, but by attaching prefixes, they can be made conditional based on screen size.&lt;/p&gt;

&lt;p&gt;For example, a &lt;em&gt;.w-full&lt;/em&gt; class will add a &lt;em&gt;width: 100%&lt;/em&gt; property on all screen sizes, but by changing the class name to &lt;em&gt;.lg:width-full&lt;/em&gt;, the &lt;em&gt;width: 100%&lt;/em&gt; property will be only applied on large screen sizes ( screen sizes &amp;gt;1024px ).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ExXQixSz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Aus3v63bXfd1cZYTS8u28eA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ExXQixSz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Aus3v63bXfd1cZYTS8u28eA.png" alt="image" width="671" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Stay ahead of the curve in software testing with our list of the 13 best&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/best-java-testing-frameworks/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;automation testing java&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;frameworks for 2023.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Support for Functions and Directives
&lt;/h3&gt;

&lt;p&gt;Functions and directives are useful features while working on a huge code base. Tailwind CSS provides a few sets of functions that we can use in our custom CSS files. These functions are evaluated during the build time and are replaced by static values in the output CSS file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Functions in Tailwind:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    height: calc(100vh - theme(spacing.20));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Directives are custom Tailwind CSS at-rules that can be used to add extra functionality or Tailwind properties inside our custom CSS file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Directives in Tailwind:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media screen(md) {
      /*will be applied for min-width = 640px */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Community Support and Plugins
&lt;/h3&gt;

&lt;p&gt;Plugins allow the developers to extend the functionalities of the Tailwind CSS framework by adding custom utilities, functions, styles, and components. Tailwind supports both official and third-party plugins.&lt;/p&gt;

&lt;p&gt;To add plugins to the project, first install them using a package manager before putting them in the &lt;em&gt;tailwind.config.js&lt;/em&gt; file. Tailwind offers support for both official and third-party plugins.&lt;/p&gt;

&lt;p&gt;As Tailwind CSS is popular among developers, you will always find some projects and libraries built on top of it. Also, it is well-maintained, so if you ever find yourself stuck on an issue, hundreds of developers will always be ready to help you!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Tired of messy JavaScript code? Make your JavaScript code visually appealing with our JavaScript formatter and&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/js-beautifier?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;js beautifier&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool. Get beautifully formatted code effortlessly.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Support for Third-Party Libraries
&lt;/h3&gt;

&lt;p&gt;Since Tailwind is a utility-based CSS framework. There are a lot of parties that provide pre-built and configured UI components that are built on top of Tailwind.&lt;/p&gt;

&lt;p&gt;Tailwind UI, created by the Tailwind team, includes a vast library of free and premium components and templates that anybody may utilize to avoid building anything from the start. There are plenty of third-party websites as well that provide pre built UI components and templates to work with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VyvuMKLY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AZR4x-C_UqdtS3rB6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VyvuMKLY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AZR4x-C_UqdtS3rB6.png" alt="image" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tailwind UI&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you are still in two minds about using Tailwind, here is a list of advantages and disadvantages of using Tailwind that will help you make your decision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Tired of manual RGB to HEX conversions?&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/convert-rgb-color-to-hex?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Convert RGB colors to HEX&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;values with ease using our fast and reliable online tool. It’s free and simple to use.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Using Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;Using Tailwind offers several advantages that make it a popular choice among web developers. These advantages stem from its unique approach to styling and its focus on utility classes. Here are some key benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tailwind enables faster development with the help of the extensive list of utility classes. These classes get directly added inside the HTML, eliminating the need to write any custom CSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every CSS property is available in the form of classes. Further, these classes have variants that can be further used to finetune the design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maintaining and scaling can be done effortlessly since all the classes provide consistent design. Also, since the name of the classes stays the same, upgrading the version in the future won’t cause any breaking changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Highly performant because the Tailwind compiler generates an output CSS file that contains the minimized and optimized version of the CSS. Hence, you only have to ship your CSS code, resulting in faster page load time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since all the classes in Tailwind are single-purpose-utility classes, you get more freedom and control over the styling of the website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using modifiers makes it easy to make your website responsive across all screen sizes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Along with the existing utility classes, Tailwind also provides a configuration file that you can use to customize the classes or extend them to add new ones.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tailwind CSS has a vast community of developers and designers who are constantly working to improve the experience. Plenty of resources are built upon Tailwind to make the development process easy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tailwind easily integrates into modern JavaScript frontend frameworks like React, Angular, Vue, Ember, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages of Using Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;While Tailwind offers numerous advantages, it’s important to acknowledge that it may not be the perfect fit for every project or developer. Here are some potential disadvantages of using Tailwind.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tailwind is a utility-based CSS framework with no component classes. As a result, the development process begins from zero.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Before using Tailwind, it is necessary to have prior knowledge of CSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All the CSS classes are directly added inside HTML. Hence, HTML files can appear to be cluttered.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Installing Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;Installing Tailwind in your project is a straightforward process, but it requires some initial setup. Here’s a general guide on how to install Tailwind.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to decode an encoded URL? Our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/url-decode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;URL Decode&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool can help to decode any encoded URL. Fast, simple, and reliable, Try it now.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Tailwind CLI
&lt;/h3&gt;

&lt;p&gt;There are multiple ways of using Tailwind. In this guide, we will see the most common way of installing Tailwind CSS. Before installing Tailwind, ensure your system has&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Node.js&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Node package manager (npm)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you don’t have either of them, you can install them from the official &lt;a href="https://nodejs.org/en"&gt;Node.js website&lt;/a&gt;. When you install Node.js, it will automatically install npm.&lt;/p&gt;

&lt;p&gt;To install Tailwind, we will create a folder for our project and open it in our code editor. I have created a folder by the name TW-Demo and opened it in VS Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_-bDeDBN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AROnKU7D6tXaDqlPH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_-bDeDBN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AROnKU7D6tXaDqlPH.png" alt="image" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Folder Structure&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, we will create our HTML and CSS files. We will create a &lt;em&gt;src&lt;/em&gt; folder, and inside that, we will create &lt;em&gt;index.html&lt;/em&gt; and &lt;em&gt;style.css&lt;/em&gt; files, as shown in the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9i_4cSce--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AmMURNeuwyXNbRdB6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9i_4cSce--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AmMURNeuwyXNbRdB6.png" alt="image" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Folder Structure&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, we will initialize the project using the command below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;gt;    npm init - y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above command will generate a &lt;em&gt;package.json&lt;/em&gt; file. The &lt;em&gt;package.json&lt;/em&gt; file contains all the metadata about the project, author, version number, and installed dependencies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--otmenBiV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AqO4fNE_Eo9YYWy4d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--otmenBiV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AqO4fNE_Eo9YYWy4d.png" alt="image" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Initializing a new npm project&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;With our project initialized, we can now install Tailwind and start working. Run the following command in your terminal. This command will install Tailwind in our project as a dev dependency.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;gt;   npm install - D tailwindcss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5fN8iead--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ACyOJBk5wCOkE8U8C.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5fN8iead--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ACyOJBk5wCOkE8U8C.png" alt="image" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Installing Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The next step is creating a configuration file for handling all our Tailwind CSS configurations. Running the following command will generate a &lt;em&gt;tailwind.config.js&lt;/em&gt; file in our project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx tailwindcss init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cqFf6pVz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXmWCCMYkflT6UtYb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cqFf6pVz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXmWCCMYkflT6UtYb.png" alt="image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Initializing Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, we need to add the location of all our template files (HTML, JavaScript) in the configuration file. After adding the paths, our configuration file should look like this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;tailwind.config.js:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
   content: ["./src/**/*.{html,js}"],
   theme: {
      extend: {},
   },
   plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By making the above change, we are denoting that all the files ending with the ‘&lt;em&gt;.html / .js&lt;/em&gt;’ extension inside the &lt;em&gt;src&lt;/em&gt; folder are template files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Keep your data safe and secure by using our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/base64-encode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Base64 Encoder&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;. With our tool, you can easily convert any type of data into a secured Base64 string. Try it now.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that we have finished the configuration process, we can add the three Tailwind directives to import base, component, and utility styles. We will add these import statements inside our &lt;em&gt;style.css&lt;/em&gt; file from the &lt;em&gt;src&lt;/em&gt; folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;style.css:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  @tailwind base;
  @tailwind components;
  @tailwind utilities;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final step is generating the CSS code using a build process. This build process will scan all the classes from template files and generate CSS code for them.&lt;/p&gt;

&lt;p&gt;The following command will run the build process in watch mode. In this command, we mention the &lt;em&gt;style.css&lt;/em&gt; file from the src folder as our input file and &lt;em&gt;output.css from the dist folder&lt;/em&gt; as the output file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; npx tailwindcss - i ./src/style.css - o. /dist/output.css --watch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L-Ee_LF2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Am9EuHvIGNCkIdqg9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L-Ee_LF2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Am9EuHvIGNCkIdqg9.png" alt="image" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Running Tailwind CSS build&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The final output is generated in the output.css file inside the &lt;em&gt;dist&lt;/em&gt; folder. Hence, we need to add this path inside our HTML file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html:&lt;/em&gt;&lt;/strong&gt;&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Tailwind CSS Demo&amp;lt;/title&amp;gt;


    &amp;lt;!-- Link to the CSS file generated after build process --&amp;gt;
    &amp;lt;link href="/dist/output.css" rel="stylesheet"&amp;gt;


&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since our build process is running in watch mode, any change in the HTML or CSS file will reflect in the output CSS file automatically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/binary-to-gray?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Binary to Gray Code&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter is a free, easy-to-use online tool that converts a binary number into its equivalent Gray code representation in just one click.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s add some HTML code and check if our setup process was a success. We will create a simple heading tag and add some text styling classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html:&lt;/em&gt;&lt;/strong&gt;&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;body&amp;gt;
    &amp;lt;h1 class="text-6xl text-red-400"&amp;gt;
An Introduction to Tailwind CSS
    &amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open your HTML file in your browser and check if the styles are applied or not. You can either open it directly or use a live server extension, as I did. The output should be similar to the below screenshot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N9hV22UW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ASfal2oA8vMXrj8cG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N9hV22UW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ASfal2oA8vMXrj8cG.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Setting up Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Great! We have now successfully set up Tailwind in our project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;A tool that converts&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/decimal-to-hex?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;decimal to hex&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;numbers into equivalent Hexadecimal representation. Input a decimal number and click ‘Convert to Hex’ to get the result in seconds.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using CDN
&lt;/h3&gt;

&lt;p&gt;The CDN method adds the Tailwind inside a webpage in just one step. In this method, a CDN link that contains the Tailwind file is added with the help of the &amp;lt; &lt;em&gt;script&lt;/em&gt; &amp;gt; tag in the head section of this website. The CDN method skips the entire installation and setup procedure and provides us a link to the Tailwind CSS file.&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Tailwind CSS Demo&amp;lt;/title&amp;gt;


    &amp;lt;!-- Link to the Tailwind CSS CDN file --&amp;gt;
    &amp;lt;script src="https://cdn.tailwindcss.com"&amp;gt;&amp;lt;/script&amp;gt;


&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For configuration changes, we can create a tailwind.config object inside the script tags.&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;script&amp;gt;
    tailwind.config= {
            content: [],
            theme: {},
            plugins: [],
        };
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although this is the fastest and easiest way of adding Tailwind, it is not the recommended one!&lt;/p&gt;

&lt;p&gt;The CDN link injects the entire Tailwind file into the webpage. This might affect the page load speeds. Also, the Tailwind file is hosted over the CDN. Hence, at times, the website can experience downtime and disruptions. The other downside of this approach is security risks, no control over the version, and less room for adding customization and local debugging.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use Tailwind CSS?
&lt;/h3&gt;

&lt;p&gt;Using Tailwind can be compared to writing inline styles in a more efficient and shorter way. Like inline styles, we add CSS properties through the style attribute. In Tailwind, we add the same styles in the form of classes through the class attribute. Consider it as using CSS properties in the form of classes.&lt;/p&gt;

&lt;p&gt;Let’s create a button with regular CSS and then use Tailwind to understand the difference.&lt;/p&gt;

&lt;h3&gt;
  
  
  Regular CSS Approach
&lt;/h3&gt;

&lt;p&gt;We will create a simple HTML button element and give a class &lt;em&gt;myButton&lt;/em&gt; to it. We will then style this button by adding a few CSS properties to &lt;em&gt;myButton&lt;/em&gt; class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html:&lt;/em&gt;&lt;/strong&gt;&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;body&amp;gt;
        &amp;lt;button class="myButton"&amp;gt;Login&amp;lt;/button&amp;gt;
    &amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;style.css:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    .myButton{
        padding:25px 50px;
        border: none;
        background-color: black;
        color: white;
        border-radius:25px;
        font-size: 24px;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YtUKTTmm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5ldgZEjDfP2gKJ1E.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YtUKTTmm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5ldgZEjDfP2gKJ1E.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Button using plain CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KxF-d2fw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Amaz5RZst8BEKRR7U.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KxF-d2fw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Amaz5RZst8BEKRR7U.png" alt="image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Tailwind CSS Approach
&lt;/h3&gt;

&lt;p&gt;Now, let’s see the Tailwind approach.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html:&lt;/em&gt;&lt;/strong&gt;&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;body&amp;gt;
       &amp;lt;button 
    class="bg-black text-white rounded-3xl px-12 py-6 text-2xl"&amp;gt;
            Login
       &amp;lt;/button&amp;gt;
    &amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WVvs0NMY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AkKcXkpQOx3OkUJAr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WVvs0NMY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AkKcXkpQOx3OkUJAr.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Button using Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As you can see, we obtained the same result without writing any CSS. We used the Tailwind utility classes to apply CSS properties to our button element.&lt;/p&gt;

&lt;p&gt;To understand this, open the Chrome Developer tools by pressing ‘Ctrl + Shift + I’ and move to the Elements tab. Now select our button element to see all the styles applied to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4s9C8LGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABKjm4l7jNefij3Yn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4s9C8LGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABKjm4l7jNefij3Yn.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, a few CSS properties were applied to our button element through the classes we added. Tailwind applies these CSS properties behind the scenes by using the utility classes that we gave.&lt;/p&gt;

&lt;p&gt;Now that we have successfully run Tailwind CSS let’s explore some common and important classes using examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Get your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/css-validator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;CSS validated&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;by our CSS Validator and eliminate syntax errors and other issues that could affect your website’s performance. Ensure your CSS code is error-free today.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Exploring Tailwind CSS Classes
&lt;/h3&gt;

&lt;p&gt;Tailwind has a lot of utility classes, and covering all of them in one blog is not possible. In this section, we will cover only the common and most used classes. For the entire list, check the official Tailwind documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Colors
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MHG_TeC6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A6UVvl6ZKtq3OKrFr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MHG_TeC6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A6UVvl6ZKtq3OKrFr.png" alt="image" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Colors&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Tailwind has a variety of predefined color classes to choose from. Each color further has different sets of variants, which are denoted by a numbered value(50,100,150,900). where 50 means the lightest and 900 means the darkest.&lt;/p&gt;

&lt;p&gt;For background colors, we can use the &lt;em&gt;bg-{color-name}-{variant-value}&lt;/em&gt; class, and for text color, we can use &lt;em&gt;text-{color-name}-{variant-value}&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;body class="bg-blue-700"&amp;gt;
      &amp;lt;h1 class="text-white"&amp;gt;Tailwind CSS Colors&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code will add a blue background color to the body and a white text color to the h1 element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4XsxyNpJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_AUob3Tmft0tIBrr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4XsxyNpJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_AUob3Tmft0tIBrr.png" alt="image" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Colors in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The entire list of colors and their variants are available on the official Tailwind documentation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Keep your JavaScript code safe from syntax errors with our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/js-escape?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;JavaScript Escape&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool by quickly and easily converting special characters in your JavaScript.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sizing
&lt;/h3&gt;

&lt;p&gt;In Tailwind, the height and width properties are denoted by the &lt;em&gt;.h-{number}&lt;/em&gt; and &lt;em&gt;.w-{number}&lt;/em&gt; classes. The number denotes the value for height and width in rem/px. A value of 1 corresponds to 0.24rem or 4px. Hence a class of &lt;em&gt;.w-1&lt;/em&gt; will add a style of &lt;em&gt;width: 4px&lt;/em&gt;; or &lt;em&gt;width: 0.25rem&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vuHHu33G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AhqZv-qK2lbmufviZ3yN9Bg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vuHHu33G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AhqZv-qK2lbmufviZ3yN9Bg.png" alt="image" width="692" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html:&lt;/em&gt;&lt;/strong&gt;&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="w-48 h-32 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code will create a teal-colored div element of &lt;em&gt;width = 12rem (192px)&lt;/em&gt; and &lt;em&gt;height = 8rem (128px)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w75_HK5K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2At9i2GEjEoD5ZX1oB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w75_HK5K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2At9i2GEjEoD5ZX1oB.png" alt="image" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Width and Height classes in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Utility classes to set height and width using relative units like percentage and screen sizes are also available. Here’s a list of a few such classes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vTLTM0ru--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AtVIN0lYvRvrXkOaeDd7yaA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vTLTM0ru--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AtVIN0lYvRvrXkOaeDd7yaA.png" alt="image" width="637" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similar classes are available as well for setting height.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--queEHTpT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2At-JSqCxCWIoDPZ71qRqlGg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--queEHTpT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2At-JSqCxCWIoDPZ71qRqlGg.png" alt="image" width="626" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Margins and Paddings
&lt;/h3&gt;

&lt;p&gt;Margins and padding properties are important for maintaining the consistency of the design. Tailwind offers tons of classes to add margins and paddings to the element.&lt;/p&gt;

&lt;p&gt;The syntax of margins is &lt;em&gt;.m-{value}&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NJHCGkB3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AoynLJWSgKhg6ICTcwJ2XGg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NJHCGkB3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AoynLJWSgKhg6ICTcwJ2XGg.png" alt="image" width="701" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For padding, we use a &lt;em&gt;.p&lt;/em&gt; prefix instead of &lt;em&gt;.m&lt;/em&gt; prefix. So, just like margins, &lt;em&gt;.p-{value}&lt;/em&gt; is a padding of &lt;em&gt;{value}&lt;/em&gt; across the whole element.&lt;/p&gt;

&lt;p&gt;To apply margins and paddings, we need to pass an appropriate number as a value. This number is similar to what we pass for width and height. For example, a class of &lt;em&gt;.p-4&lt;/em&gt; denotes a CSS property of &lt;em&gt;padding: 16px; or padding: 1rem&lt;/em&gt;;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class=" flex h-screen pt-20"&amp;gt;
            &amp;lt;div class="w-32 h-32 bg-teal-400 mt-10"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;div class="w-32 h-32 bg-teal-400 ml-20"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;div class="w-32 h-32 bg-teal-400 ml-10 p-20"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EZ4aH-0I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AryxIszIYrqvKgfWc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EZ4aH-0I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AryxIszIYrqvKgfWc.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Margins and Paddings in Tailwind CSS&lt;/em&gt;&lt;br&gt;&lt;br&gt;
The below table shows some standard margin classes and the CSS properties that they represent. For padding, use ‘&lt;em&gt;p&lt;/em&gt;’ instead of ‘&lt;em&gt;m&lt;/em&gt;’.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T3zx5ZJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AZdinzrUvAfb0XpQ1GoLnFw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T3zx5ZJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AZdinzrUvAfb0XpQ1GoLnFw.png" alt="image" width="583" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Beautify your HTML and improve readability of the code with our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-prettify?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML Prettify&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool. Beautify your code and save time on your projects.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Flexbox
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/blog/css-flexbox-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Flexbox&lt;/a&gt; is a layout model in CSS that is used for creating website layouts, alignments, and distributing elements across the webpage. Flexbox plays a major role in adding responsive behavior to the website. To use Flexbox in Tailwind, we need to use the &lt;em&gt;.flex&lt;/em&gt; class to add the &lt;em&gt;display: flex;&lt;/em&gt; property. We can then define the &lt;em&gt;flex-direction&lt;/em&gt; using the &lt;em&gt;.flex-row&lt;/em&gt; and &lt;em&gt;.flex-col&lt;/em&gt; classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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=" flex flex-row gap-6"&amp;gt;
            &amp;lt;div class="w-32 h-32 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;div class="w-32 h-32 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;div class="w-32 h-32 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
   &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--utu2sK8T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AxvmtCqmZXv5axIQQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--utu2sK8T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AxvmtCqmZXv5axIQQ.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Flexbox in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The table below shows some standard Flexbox classes and the CSS properties that they represent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3lJI-eWR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2A1mdNLZbeufaPcqN9G0ilaQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3lJI-eWR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2A1mdNLZbeufaPcqN9G0ilaQ.png" alt="image" width="591" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Flexbox Content Alignment
&lt;/h3&gt;

&lt;p&gt;Just like we have classes for Flexbox, we have classes to control how content inside the flexbox is laid out. The &lt;em&gt;.justify-content&lt;/em&gt; property in CSS is used to align the content along the main axis ( if &lt;em&gt;flex-direction&lt;/em&gt; = row, then main axis = x-axis, &lt;em&gt;flex-direction&lt;/em&gt; = column, then main axis = y-axis).&lt;/p&gt;

&lt;p&gt;Tailwind contains &lt;em&gt;.justify-{direction}&lt;/em&gt; class to denote the &lt;em&gt;justify-content&lt;/em&gt; CSS property. The direction value determines the direction in which the content inside the flexbox will be positioned. So .&lt;em&gt;justify-center is justify-content: center;&lt;/em&gt; and similarly &lt;em&gt;.justify-between is justify-content: between;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class="flex flex-col min-h-screen"&amp;gt;
            &amp;lt;div class="p-4 text-xl"&amp;gt;
                justify-start
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="flex flex-row justify-start bg-slate-200 p-4 gap-12"&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="p-4 text-xl"&amp;gt;
                justify-center
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="flex flex-row justify-center bg-slate-200 p-4 gap-12"&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="p-4 text-xl"&amp;gt;
                justify-end
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="flex flex-row justify-end bg-slate-200 p-4 gap-12"&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="p-4 text-xl"&amp;gt;
                justify-between
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="flex flex-row justify-between bg-slate-200 p-4 gap-12"&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="p-4 text-xl"&amp;gt;
                justify-around
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="flex flex-row justify-around bg-slate-200 p-4 gap-12"&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="p-4 text-xl"&amp;gt;
                justify-evenly
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="flex flex-row justify-evenly bg-slate-200 p-4 gap-12"&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
                &amp;lt;div class="w-12 h-12 bg-teal-400 rounded-md"&amp;gt;&amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y65ysUq6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AhQumDuzytN-yP2iz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y65ysUq6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AhQumDuzytN-yP2iz.png" alt="image" width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Justify content in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here is a list of all the &lt;em&gt;justify-content&lt;/em&gt; property class names.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qYNET7t---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2ANe2_xA43dInSBaVG_y2AfQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qYNET7t---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2ANe2_xA43dInSBaVG_y2AfQ.png" alt="image" width="600" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similar to the &lt;em&gt;justify-content&lt;/em&gt; property, the &lt;em&gt;align-items&lt;/em&gt; property is used to align context across the cross-axis ( if &lt;em&gt;flex-direction&lt;/em&gt; = row, then cross-axis = y-axis, &lt;em&gt;flex-direction&lt;/em&gt; = column, then cross-axis = x-axis). The table below contains all the classes that denote the &lt;em&gt;align-items&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class="flex flex-col min-h-screen"&amp;gt;
                    &amp;lt;div class="p-4 text-xl"&amp;gt;
                        items-start
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div class="flex flex-row items-start bg-slate-200 p-4 gap-12"&amp;gt;
                        &amp;lt;div class="w-24 h-12 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-20 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-32 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-28 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div class="p-4 text-xl"&amp;gt;
                        items-center
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div class="flex flex-row items-center bg-slate-200 p-4 gap-12"&amp;gt;
                        &amp;lt;div class="w-24 h-12 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-20 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-32 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-28 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div class="p-4 text-xl"&amp;gt;
                        items-end
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div class="flex flex-row items-end bg-slate-200 p-4 gap-12"&amp;gt;
                        &amp;lt;div class="w-24 h-12 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-20 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-32 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                        &amp;lt;div class="w-24 h-28 bg-teal-400"&amp;gt;&amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y6DkSPDe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Ac79CosGLcVBfx1pk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y6DkSPDe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Ac79CosGLcVBfx1pk.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Align items in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w39HqJ6Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AQWeAtENjhc3BsqsnL4P6CA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w39HqJ6Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AQWeAtENjhc3BsqsnL4P6CA.png" alt="image" width="615" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-minify?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML Minify&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;is a perfect tool for anyone looking to optimize website’s speed. Minify your code and optimize website for faster loading times in few seconds.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Grids
&lt;/h3&gt;

&lt;p&gt;Many developers avoid &lt;a href="https://www.lambdatest.com/blog/css-grid/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS grid&lt;/a&gt;s and use flexboxes while designing the layout of their websites due to the complexity. Tailwind simplifies the working of the grid and provides simple and easy-to-use classes for developers.&lt;/p&gt;

&lt;p&gt;Using the &lt;em&gt;.grid-cols-{number}&lt;/em&gt; class, we can define the number of columns inside a grid layout. So &lt;em&gt;.grid-cols-2&lt;/em&gt; will create a two-column layout inside a grid container. For specifying the gap between columns, &lt;em&gt;.gap-{number}&lt;/em&gt; is an important utility. The &lt;em&gt;.gap-{x}&lt;/em&gt; class represents the gap property in CSS, which controls gutters between grids and flexbox. Let’s see an example to understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Column Grid Example:&lt;/strong&gt;&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;section class="grid grid-cols-5 gap-4 p-10"&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Online Browser Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Cypress Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Selenium Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Playwright Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            HyperExecute
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            On-Premise Selenium Grid
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Native Mobile App Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Real Devices Cloud
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Visual Regression Cloud
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Test Intelligence
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nVcbNSYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2P6Ge7-mH0yhxg4_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nVcbNSYq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2P6Ge7-mH0yhxg4_.png" alt="image" width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Grid in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Row Grid Example:&lt;/strong&gt;&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;section class="grid grid-rows-3 grid-flow-col gap-4 p-10"&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Online Browser Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Cypress Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Selenium Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Playwright Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            HyperExecute
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            On-Premise Selenium Grid
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Native Mobile App Testing
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Real Devices Cloud
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Visual Regression Cloud
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-36 h-36 bg-teal-200 rounded-md flex justify-center items-center text-center"&amp;gt;
            Test Intelligence
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KoTqd7a0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Ab1rdwS3PolGVw7LB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KoTqd7a0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Ab1rdwS3PolGVw7LB.png" alt="image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A list of commonly used grid column and row layout classes is mentioned below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3khxjp6N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2ArAEgsRmI5t56JNMTBenRqQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3khxjp6N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2ArAEgsRmI5t56JNMTBenRqQ.png" alt="image" width="727" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Test your native, hybrid, and web apps across all legacy and latest mobile operating systems on the most powerful&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/android-emulator-online?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;Android emulator online&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Background
&lt;/h3&gt;

&lt;p&gt;The utility classes provided by Tailwind to control the background styles start with &lt;em&gt;.bg-{property-name}&lt;/em&gt;. For example, &lt;em&gt;.bg-fixed&lt;/em&gt; is for &lt;em&gt;background-attachment: fixed;&lt;/em&gt; property. Similarly, &lt;em&gt;.bg-red-400&lt;/em&gt; is for setting the background color as the red of variant 400. Let’s see a simple example to understand how to use background properties.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class="flex bg-gray-200 gap-10 flex-row justify-center min-h-screen"&amp;gt;
    &amp;lt;div
        class="w-2/3 bg-center bg-cover bg-no-repeat
            bg-[url('https://www.lambdatest.com/resources/images/icons/banner1.webp')]"&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pJjZgc2w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8groud57kj453738q0sn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pJjZgc2w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8groud57kj453738q0sn.png" alt="Image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Handling Background in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the above example, I am setting the background image by passing in an arbitrary value. We will discuss this feature in the later part of the tutorial. The table below contains all the important background properties provided by Tailwind.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--woTdOdCD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0lsl1uhg1uor1ysgzcp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--woTdOdCD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0lsl1uhg1uor1ysgzcp.png" alt="Image" width="687" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This article explains the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/emulator-vs-simulator-vs-real-device/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;emulator vs simulator vs real device&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;differences, the learning of which can help you select the right mobile testing solution for your business.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Text and Font
&lt;/h3&gt;

&lt;p&gt;Tailwind has tons of utilities for controlling the font and text styling for the textual elements. All the classes that control the font properties start with &lt;em&gt;.font-{property-name},&lt;/em&gt; and the ones that control the text properties start with &lt;em&gt;.text-{property-name}.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class=" flex flex-col gap-10 p-10 text-4xl min-h-screen"&amp;gt;
    &amp;lt;p class="italic"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud&amp;lt;/p&amp;gt;
    &amp;lt;p class="font-bold"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud&amp;lt;/p&amp;gt;
    &amp;lt;p class="font-thin"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud&amp;lt;/p&amp;gt;
    &amp;lt;p class="underline"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud&amp;lt;/p&amp;gt;
    &amp;lt;p class="text-sm"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud&amp;lt;/p&amp;gt;
    &amp;lt;p class="text-right"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud&amp;lt;/p&amp;gt;
    &amp;lt;p class="text-center"&amp;gt;Next-Generation Mobile Apps and Cross Browser Testing Cloud&amp;lt;/p&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vbcLnRGD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AjfcTyIizMrelkS6Z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vbcLnRGD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AjfcTyIizMrelkS6Z.png" alt="image" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Text and Font in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Check the below list of a few common and popular Tailwind CSS classes and the properties that they represent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zfe4PdGz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AA5oyWXJ1_bQSec3teN8fBQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zfe4PdGz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AA5oyWXJ1_bQSec3teN8fBQ.png" alt="image" width="483" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Transition
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;transition&lt;/em&gt; property in CSS is used to specify how a property change transition effect will occur. Tailwind CSS uses the .&lt;em&gt;transition-{property-name}&lt;/em&gt; class to denote the &lt;em&gt;transition&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class="flex flex-row justify-center gap-10 p-10 text-2xl"&amp;gt;
     &amp;lt;div class="w-48 h-48 bg-teal-300 rounded-md flex justify-center     items-center hover:bg-red-400 transition-none"&amp;gt;
                        No Transition
                    &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-48 h-48 bg-teal-300 rounded-md flex justify-center items-center
                                transition-all duration-500 ease-linear hover:bg-red-400"&amp;gt;
                        All Transition
                    &amp;lt;/div&amp;gt;
              &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M-N7RgB2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bqijkmu55h1zorn5zd3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M-N7RgB2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bqijkmu55h1zorn5zd3.png" alt="Image" width="600" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s a list of all the important and most used transition classes in Tailwind CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v6v11Sjp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/14zuj9q08l8xawj33jcm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v6v11Sjp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/14zuj9q08l8xawj33jcm.png" alt="Image" width="624" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Want to convert SCSS to clean, concise CSS? Convert&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/emulator-vs-simulator-vs-real-device/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;SCSS to CSS&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;like a pro with our intuitive online tool. Get clean, readable code instantly. Start converting today.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Transition
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;transition&lt;/em&gt; property in CSS is used to specify how a property change transition effect will occur. Tailwind CSS uses the .&lt;em&gt;transition-{property-name}&lt;/em&gt; class to denote the &lt;em&gt;transition&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class="flex flex-row justify-center gap-10 p-10 text-2xl"&amp;gt;
     &amp;lt;div class="w-48 h-48 bg-teal-300 rounded-md flex justify-center     items-center hover:bg-red-400 transition-none"&amp;gt;
                        No Transition
                    &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-48 h-48 bg-teal-300 rounded-md flex justify-center items-center
                                transition-all duration-500 ease-linear hover:bg-red-400"&amp;gt;
                        All Transition
                    &amp;lt;/div&amp;gt;
              &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r2lHTOR9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVLD1x6X6q5qjc5vX.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r2lHTOR9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVLD1x6X6q5qjc5vX.gif" alt="image" width="600" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s a list of all the important and most used transition classes in Tailwind CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tb1gyGKm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Aj2swYCKXbRha2XhaANnX8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tb1gyGKm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Aj2swYCKXbRha2XhaANnX8w.png" alt="image" width="616" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Transition
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;transition&lt;/em&gt; property in CSS is used to specify how a property change transition effect will occur. Tailwind CSS uses the .&lt;em&gt;transition-{property-name}&lt;/em&gt; class to denote the &lt;em&gt;transition&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;section class="flex flex-row justify-center gap-10 p-10 text-2xl"&amp;gt;
     &amp;lt;div class="w-48 h-48 bg-teal-300 rounded-md flex justify-center     items-center hover:bg-red-400 transition-none"&amp;gt;
                        No Transition
                    &amp;lt;/div&amp;gt;
        &amp;lt;div class="w-48 h-48 bg-teal-300 rounded-md flex justify-center items-center
                                transition-all duration-500 ease-linear hover:bg-red-400"&amp;gt;
                        All Transition
                    &amp;lt;/div&amp;gt;
              &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f9JK9lE6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ARvhwH-Z9t6mn2m8e.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f9JK9lE6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ARvhwH-Z9t6mn2m8e.gif" alt="image" width="600" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s a list of all the important and most used transition classes in Tailwind CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jrwZrU2m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AXFjY8IEo_dyaroPF4CAoEQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jrwZrU2m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AXFjY8IEo_dyaroPF4CAoEQ.png" alt="image" width="457" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each &lt;em&gt;transition&lt;/em&gt; property comes with a default easing function and &lt;em&gt;duration&lt;/em&gt; property. But Tailwind CSS allows us to change them by overriding them using the .&lt;em&gt;ease-{timing-function}&lt;/em&gt; and &lt;em&gt;.duration-{time},&lt;/em&gt; respectively.&lt;/p&gt;

&lt;p&gt;For example, the &lt;em&gt;.ease-linear&lt;/em&gt; class will override the default timing function property with the new &lt;em&gt;transition-timing-function: linear;&lt;/em&gt; property. Similarity &lt;em&gt;.duration-500&lt;/em&gt; will override the default value of 150 ms duration with a 500 ms value.&lt;/p&gt;

&lt;h3&gt;
  
  
  Animations
&lt;/h3&gt;

&lt;p&gt;Animations are an important part of any website. Tailwind CSS has a few preconfigured utility classes that can be used to add &lt;a href="https://www.lambdatest.com/blog/css-animations-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS animations&lt;/a&gt; to any elements on the screen. Behind the scenes, these classes use keyframes to create animations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Code:&lt;/strong&gt;&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;section 
class="flex min-h-screen gap-20 justify-center items-center"&amp;gt;
          &amp;lt;div 
             class="w-32 h-32 bg-teal-400 rounded-md animate-spin"&amp;gt;
      &amp;lt;/div&amp;gt;
          &amp;lt;div 
            class="w-32 h-32 bg-teal-400 rounded-full animate-ping"&amp;gt;
      &amp;lt;/div&amp;gt;
          &amp;lt;div 
            class="w-32 h-32 bg-teal-400 rounded-full animate-pulse"&amp;gt;
      &amp;lt;/div&amp;gt;
          &amp;lt;div 
            class="w-32 h-32 bg-teal-400 rounded-full animate-bounce"&amp;gt;
          &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Animations in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Tired of using old colors? Get your creative juices flowing with our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-color-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;random color generator&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;. Try our tool to find fresh new hues.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Modifiers for Handling States of Elements
&lt;/h3&gt;

&lt;p&gt;Each and every utility class in Tailwind can be applied conditionally using a modifier prefix. The conditions can be a specific element state like hover, active, disabled, or a pseudo-element like first-child, placeholder text, markers, etc.&lt;/p&gt;

&lt;p&gt;For example, a &lt;em&gt;bg-black&lt;/em&gt; class will set the background color as black for an element, but the &lt;em&gt;hover:bg-black&lt;/em&gt; class will only set the background color as black when the user hovers the cursor over the element. Similarly, using the &lt;em&gt;text-red-500&lt;/em&gt; class over an anchor tag element will make the link red. But the &lt;em&gt;visited:text-red-500&lt;/em&gt; variation will make the link red only if it has been visited.&lt;/p&gt;

&lt;p&gt;Tailwind contains modifiers for all CSS &lt;a href="https://www.lambdatest.com/blog/css-pseudo-class-selectors/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;pseudo-classes&lt;/a&gt;, pseudo-elements, media queries, feature queries, and attribute selectors. In the below table, you can find modifiers for all the important pseudo-classes and pseudo-elements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z9-nHaP9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xvqkajlxgyy8xlm8eze7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z9-nHaP9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xvqkajlxgyy8xlm8eze7.png" alt="Image" width="675" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the below example, we are conditionally setting the background color property of the body element based on the viewport size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pn4qI-x4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zz3k71v5gz1kfgktql3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pn4qI-x4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zz3k71v5gz1kfgktql3.png" alt="Image" width="600" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Conditional classes in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Customizing Default Tailwind CSS classes
&lt;/h3&gt;

&lt;p&gt;Tailwind has its own design system. All the classes and their variants follow a fixed set of values, which are predefined and configured according to the design system. Tailwind CSS uses a specific design system where all class styles and variations have predetermined values, ensuring everything looks consistent. But what if the project demands different styles or values that are absent in Tailwind?&lt;/p&gt;

&lt;p&gt;In such cases, we can customize the existing styles with our own values defined inside the &lt;em&gt;tailwind.config.js&lt;/em&gt; file. We can either redefine the default values again for classes or create entirely new values.&lt;/p&gt;

&lt;p&gt;To create custom values, we first define the values inside the &lt;em&gt;tailwind.config.js&lt;/em&gt; file. We will add four custom colors inside a colors object and add them inside the theme object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
    content: ["./src/**/*.{html,js}"],
    theme: {
      colors: {
       myBlue: "#2827CC",
       myRed: "#EB4D4B",
       myGreen: "#0ebac5",
       myYellow: "#F7CD2E",
     },
      extend: {},
   },
   plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the &lt;em&gt;tailwind.config.js&lt;/em&gt; file is configured, we can use these values inside our HTML file like other classes. Here, we are applying a background color of our custom values.&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="w-48 h-48 bg-myBlue"&amp;gt;


        &amp;lt;/div&amp;gt;

        &amp;lt;div class="w-48 h-48 bg-myRed"&amp;gt;

        &amp;lt;/div&amp;gt;


        &amp;lt;div class="w-48 h-48 bg-myGreen"&amp;gt;

        &amp;lt;/div&amp;gt;

        &amp;lt;div class="w-48 h-48 bg-myYellow"&amp;gt;

        &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ODYnPFle--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1sufs6fa8u6zof8qh01q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ODYnPFle--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1sufs6fa8u6zof8qh01q.png" alt="Image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Using custom properties in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And it doesn’t stop here! We can also extend the existing list of values by adding our new ones. For example, we can add a new font-size value in the already existing list of values like &lt;em&gt;sm&lt;/em&gt;,&lt;em&gt;md&lt;/em&gt;, …., &lt;em&gt;xl&lt;/em&gt;, &lt;em&gt;2xl up&lt;/em&gt; to &lt;em&gt;9xl&lt;/em&gt;, etc.&lt;/p&gt;

&lt;p&gt;The new values to be extended must be added inside the extend object in the &lt;em&gt;tailwind.config.js&lt;/em&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */


module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    colors: {
      myBlue: "#2827CC",
      myRed: "#EB4D4B",
      myGreen: "#4DD637",
      myYellow: "#F7CD2E",
    },
    extend: {
      fontSize: {
        50: "50px",
        60: "60px",
        70: "70px",
      },
    },
  },
  plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once declared inside the configuration file, we can use them like other classes in our HTML file.&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;h1 class="text-5xl"&amp;gt;A text with 5xl default size&amp;lt;/h1&amp;gt;


    &amp;lt;h1 class="text-50"&amp;gt;A text with 50px custom size&amp;lt;/h1&amp;gt;

    &amp;lt;h1 class="text-60"&amp;gt;A text with 60px custom size&amp;lt;/h1&amp;gt;

    &amp;lt;h1 class="text-70"&amp;gt;A text with 70px custom size&amp;lt;/h1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wjx1Y0Cf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39s82xvveyjmrnn0otch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wjx1Y0Cf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39s82xvveyjmrnn0otch.png" alt="Image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Extending Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Creating a custom theme completely replaces Tailwind’s default configured values. Hence, by declaring our own values, we won’t be able to use the already existing Tailwind values. But by extending the Tailwind CSS values, we can preserve the existing ones while adding new ones of our own.&lt;/p&gt;

&lt;p&gt;This customization feature of Tailwind makes it a game changer and a preferred framework as compared to the other frameworks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need a random MAC address for your work? Our online tool is fast and easy-to-use for&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-mac-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;generating random MAC addresses&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with just a few clicks.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Arbitrary Values in Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;In some cases, we might run into a situation where we need a custom value just once. In such cases, defining a new variable inside the configuration file might be an overkill. In such cases, we can make use of the Just in Time (JIT) compilation feature of Tailwind CSS to pass custom values directly to the classes.&lt;/p&gt;

&lt;p&gt;This feature allows us to break out of the existing design system using custom values. To use custom values in classes, add the value inside the square brackets and then attach it to the class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;.bg-red-500&lt;/em&gt; is a class that carries Tailwind CSS-defined values. But using the &lt;em&gt;.bg-[#123123],&lt;/em&gt; we can give a custom color value of &lt;em&gt;#123123&lt;/em&gt; to the &lt;em&gt;.bg&lt;/em&gt; class. Similarly, we can pass arbitrary values to all sorts of classes like .&lt;em&gt;w-[50px], .m-[2px], .text-[#222]&lt;/em&gt;, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!--Red Color variant provided by Tailwind CSS--&amp;gt;
    &amp;lt;div class="w-48 h-48 bg-red-500"&amp;gt;


    &amp;lt;/div&amp;gt;


    &amp;lt;!--Custom Red Color variant--&amp;gt;
    &amp;lt;div class="w-48 h-48 bg-[#E6425E]"&amp;gt;

    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kf82Gtyj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n5i6b5iq0wpd39wllimg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kf82Gtyj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n5i6b5iq0wpd39wllimg.png" alt="Image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Arbitrary values in Tailwind CSS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Behind the scenes, the Just In Time compiler of Tailwind CSS generates the CSS code from arbitrary values provided to the classes. While using this feature, passing the values that the CSS property can recognize is necessary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XCnmfT7b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3bBmmuAUNWvwxTCQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XCnmfT7b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3bBmmuAUNWvwxTCQ.png" alt="image" width="382" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo: Building Developer Portfolio Using Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;As a developer, it is essential to have your own Portfolio website to showcase your work and skills, and publish blogs. Your Portfolio website can be very useful for building an identity online. If you are applying for a job role, a well-designed portfolio website will greatly impact the recruiter.&lt;/p&gt;

&lt;p&gt;In this part of the blog, we will create a modern minimalist Portfolio website using HTML, Tailwind CSS, and JavaScript. Now that we know about Tailwind CSS and how to use it, building a Portfolio website will be good practice and give us much-needed hands-on experience.&lt;/p&gt;

&lt;p&gt;Here’s what we are making. You can check this live version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8OZmQZH7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AF0_sMuMvEb6QYCoC.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8OZmQZH7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AF0_sMuMvEb6QYCoC.gif" alt="image" width="600" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Developer Portfolio&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We will be making a single-page Portfolio website. The website will be divided into 7 sections.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Home&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;About&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Work Experience&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Projects or Works&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Services&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blogs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Contact&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, we will have a navbar at the top and a footer at the bottom of the page. We will make sure our website is responsive across all devices. In the end, we will add a button to switch between the light theme and the dark theme for our website. The theme toggler feature will be the highlight of our website. So let’s get started!&lt;/p&gt;

&lt;h3&gt;
  
  
  Folder Structure
&lt;/h3&gt;

&lt;p&gt;First, let’s create the folder structure for our Portfolio website. We will create a folder with the name Portfolio. We will create a &lt;em&gt;src&lt;/em&gt; folder in the Portfolio folder containing our HTML file, CSS files, and assets. The entire code for the Portfolio website can be found on my &lt;a href="https://github.com/anuraggharat/Minimalistic_Portfolio"&gt;GitHub&lt;/a&gt;. For just the boilerplate code, switch to the &lt;a href="https://github.com/anuraggharat/Minimalistic_Portfolio"&gt;GitHub starter branch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HOvNS8ys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVFlIZXtOM3Bn8xsR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HOvNS8ys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVFlIZXtOM3Bn8xsR.png" alt="image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to make your folder structure, modify the build commands and link tags as per your folder structure.&lt;/p&gt;

&lt;p&gt;To set up Tailwind CSS inside this folder, we will follow the steps discussed in the Setting up Tailwind CSS section.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Initialize a new project using
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;   npm init - y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install Tailwind CSS using
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; npm install - D tailwindcss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Initialize Tailwind CSS using
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;   npx tailwindcss init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Update the &lt;em&gt;tailwind.config.js&lt;/em&gt; file with template file extensions.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
   content: ["./src/**/*.{html,js}"],
   theme: {
      extend: {},
   },
   plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Inject the Tailwind CSS base, component, and utilities inside &lt;em&gt;style.css.&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
  @tailwind components;
  @tailwind utilities;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Generate the &lt;em&gt;output.css&lt;/em&gt; file in watch mode.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We will not create a separate &lt;em&gt;dist&lt;/em&gt; folder for the &lt;em&gt;output.css&lt;/em&gt; file. Instead, we will generate the output file inside the &lt;em&gt;src&lt;/em&gt; folder itself. This will make it easy for us to host our website on a hosting platform later. So, the command for generating the output file will contain the &lt;em&gt;src&lt;/em&gt; folder instead of the &lt;em&gt;dist&lt;/em&gt; folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; npx tailwindcss - i ./src/style.css - o ./src/output.css --watch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Talking about the fonts and icons, we will use a Poppins font. You are free to use your favorite font. We need to include Poppins as a font inside our configuration file. Once included, we can apply it using the &lt;em&gt;@layer&lt;/em&gt; directive inside the &lt;em&gt;style.css&lt;/em&gt; file. This will set the default font family of the website to Poppins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;tailwind.config.js&lt;/em&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    extend: {
      fontFamily:{
        'poppins':['Poppins','sans-serif']
      }
    },
  },
  plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;style.css&lt;/em&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
@tailwind components;
@tailwind utilities;


@layer base {
    html {
        scroll-behavior: smooth;
    }
    body{
        @apply font-poppins
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For icons, we will use Remix icons which are easy to use and look elegant on the UI. We will import these icons using the link tag inside the head section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7JvnWtih--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Awr_wS99zflSBh0Uk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7JvnWtih--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Awr_wS99zflSBh0Uk.png" alt="image" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Remix Icons&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We will build the website with one section at a time; let’s start by creating the structure for our website. We will use &lt;em&gt;&amp;lt; section &amp;gt;&lt;/em&gt; tags for our 7 content sections, &lt;em&gt;&amp;lt; navbar &amp;gt;&lt;/em&gt; for the top navigation bar, and &lt;em&gt;&amp;lt; footer &amp;gt;&lt;/em&gt; for the footer. This will help us maintain consistent styling and follow HTML semantic principles.&lt;/p&gt;

&lt;p&gt;At the end of the file, we will add a &lt;em&gt;&amp;lt; script &amp;gt;&lt;/em&gt; tag to put our JavaScript code. We will need JavaScript to build a menu toggle button and theme switch to toggle between dark and light modes. Here’s what the structure of the site looks like.&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;


&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Tailwind CSS Portfolio&amp;lt;/title&amp;gt;


    &amp;lt;!-- Link to the CSS file generated after build process --&amp;gt;
    &amp;lt;link href="./output.css" rel="stylesheet"&amp;gt;



    &amp;lt;!-- CDN for Remix icons --&amp;gt;
    &amp;lt;link href="https://cdn.jsdelivr.net/npm/remixicon@3.4.0/fonts/remixicon.css" rel="stylesheet"&amp;gt;



    &amp;lt;!-- Add your Meta tags here --&amp;gt;


&amp;lt;/head&amp;gt;




&amp;lt;body&amp;gt;


    &amp;lt;!-- navbar component --&amp;gt;
    &amp;lt;nav&amp;gt;
    &amp;lt;/nav&amp;gt;


    &amp;lt;!-- main content section --&amp;gt;
    &amp;lt;main&amp;gt;


            &amp;lt;!-- Home section --&amp;gt;
            &amp;lt;section&amp;gt;
            &amp;lt;/section&amp;gt;

            &amp;lt;!-- About Section --&amp;gt;
            &amp;lt;section&amp;gt;
            &amp;lt;/section&amp;gt;

            &amp;lt;!-- Work Experience section --&amp;gt;
            &amp;lt;section&amp;gt;
            &amp;lt;/section&amp;gt;

            &amp;lt;!-- Works section --&amp;gt;
            &amp;lt;section&amp;gt;
            &amp;lt;/section&amp;gt;

            &amp;lt;!-- What I offer section --&amp;gt;
            &amp;lt;section&amp;gt;
            &amp;lt;/section&amp;gt;

            &amp;lt;!-- Blogs Section --&amp;gt;
            &amp;lt;section&amp;gt;
            &amp;lt;/section&amp;gt;


            &amp;lt;!-- Contact section --&amp;gt;
            &amp;lt;section&amp;gt;
            &amp;lt;/section&amp;gt;

            &amp;lt;!-- footer component --&amp;gt;
            &amp;lt;footer&amp;gt;
            &amp;lt;/footer&amp;gt;

    &amp;lt;/main&amp;gt;


&amp;lt;/body&amp;gt;


&amp;lt;/html&amp;gt;


&amp;lt;!-- JavaScript for Menu togglers and Dark Mode functionality --&amp;gt;
&amp;lt;script&amp;gt;


//JavaScript goes here


&amp;lt;/script&amp;gt;Setting the Alignment and Width
Before we start creating our section, let’s fix the size of our website. For our website, we will give it a maximum width of 1152px or 72rem. This is to restrict the width of website content on extra-large screens. We will apply the maximum width class of max-w-6xl to the main element.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Setting the Alignment and Width
&lt;/h3&gt;

&lt;p&gt;Before we start creating our section, let’s fix the size of our website. For our website, we will give it a maximum width of &lt;em&gt;1152px&lt;/em&gt; or &lt;em&gt;72rem&lt;/em&gt;. This is to restrict the width of website content on extra-large screens. We will apply the maximum width class of &lt;em&gt;max-w-6xl&lt;/em&gt; to the main element.&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;main class="max-w-6xl dark:text-white"&amp;gt;

    &amp;lt;!--Add Content here--&amp;gt;


      &amp;lt;/main&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will also make all the elements inside the body tag as &lt;em&gt;flex-direction: column&lt;/em&gt; and place them horizontally at center. We will also set the background color of the body as white and position as relative.&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;body class="relative flex flex-col items-center bg-white"&amp;gt;


            &amp;lt;!--Add Content here--&amp;gt;




        &amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need a block of text? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-paragraph-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;random paragraph generator&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;to create random paragraphs and add some variety to your content and keep your audience interested.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Navbar
&lt;/h3&gt;

&lt;p&gt;Let’s start by creating our navbar component that will be fixed at the top. The navbar will be divided into three parts. The left part will contain the brand name or logo for the website, the middle part will contain all the links to navigate, and the right part will contain the theme toggler button and menu button.&lt;/p&gt;

&lt;p&gt;Here are some features of the navbar:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The navbar will be fixed on top.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A transparent background will give a glass effect on scrolling.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Theme toggler button, which will change from sun icon to moon icon while toggling&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Horizontal links tab, which will get hidden on small screens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The menu button will create a drop-down for links on smaller screens.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Right now, while building the website, we will add styles for dark mode as well. We will activate these classes when working on the dark mode feature.&lt;/p&gt;

&lt;p&gt;Here’s what the code for the navbar looks like.&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;!-- navbar component --&amp;gt;
    &amp;lt;nav class="fixed backdrop-blur-md bg-white dark:bg-[#121212] bg-opacity-60 w-full flex flex-row justify-center z-20"&amp;gt;
            &amp;lt;div class="flex flex-row justify-between items-center w-[72rem] p-4 "&amp;gt;
                &amp;lt;div class="flex dark:text-white"&amp;gt;
                    &amp;lt;p&amp;gt;AG.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="flex flex-row justify-end md:justify-between w-full md:w-auto gap-4 md:gap-10"&amp;gt;
                    &amp;lt;!--Links component - Visible on large screens and not on small screens--&amp;gt;
                    &amp;lt;ul class="hidden md:flex flex-row items-center text-sm md:text-base gap-4 md:gap-10 border border-gray-300 dark:border-gray-600 bg-white dark:bg-[#121212] dark:text-white rounded-full px-6 md:px-10 w-auto h-12 md:h-16 "&amp;gt;
                        &amp;lt;li&amp;gt;
                            &amp;lt;a href="#" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;Home&amp;lt;/a&amp;gt;
                        &amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;
                            &amp;lt;a href="#about" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;About&amp;lt;/a&amp;gt;
                        &amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;
                            &amp;lt;a href="#work" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;Work&amp;lt;/a&amp;gt;
                        &amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;
                            &amp;lt;a href="#blogs" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;Blogs&amp;lt;/a&amp;gt;
                        &amp;lt;/li&amp;gt;
                        &amp;lt;li&amp;gt;
                            &amp;lt;a href="#contact" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;Contact&amp;lt;/a&amp;gt;
                        &amp;lt;/li&amp;gt;

                    &amp;lt;/ul&amp;gt;  
                    &amp;lt;!--Button to change theme--&amp;gt;
                    &amp;lt;button onclick="toggleTheme()"
                        class=" flex bg-white w-12 h-12 md:w-16 md:h-16 flex-row justify-center items-center border-gray-300 dark:border-gray-600 dark:bg-[#121212] dark:text-white border rounded-full"&amp;gt;
                        &amp;lt;i  id="theme-toggler-moon" class="ri-moon-clear-line text-blue-800 ri-xl" id="sun-icon"&amp;gt;&amp;lt;/i&amp;gt;
                    &amp;lt;/button&amp;gt;

                    &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;      
    &amp;lt;/nav&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--emoSV2uw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssyxnh75xb48v2hh1bal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--emoSV2uw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssyxnh75xb48v2hh1bal.png" alt="Image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Navigation bar&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Home Section
&lt;/h3&gt;

&lt;p&gt;The home section (or hero section) is a two-column layout. On one side, we will have a headline, name, and what we do. On the other side, we will have a display picture. We will also add a button pointing to the drive link for our resume or CV.&lt;/p&gt;

&lt;p&gt;We will build this two-column layout using a flexbox. On large screens, this layout will be horizontal, while on smaller screens, we will stack them on top of each other in a single-column layout.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html&lt;/em&gt;:&lt;/strong&gt;&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;!-- Home section --&amp;gt;
            &amp;lt;section class="flex flex-col w-full h-auto min-h-screen justify-center relative px-6 md:px-4"&amp;gt;

                &amp;lt;div class="flex flex-col-reverse md:flex-row flex-wrap gap-10 md:gap-0"&amp;gt;
                    &amp;lt;div class="w-full md:w-3/5 flex flex-col justify-center items-start dark:text-white"&amp;gt;
                        &amp;lt;h1 class="text-4xl md:text-5xl font-semibold"&amp;gt;Hey there, I'm Anurag!&amp;lt;/h1&amp;gt;
                        &amp;lt;h2 class="text-lg md:text-2xl my-2 md:my-6"&amp;gt;A Full Stack Developer and Designer based in India&amp;lt;/h2&amp;gt;
                        &amp;lt;p class="text-sm md:text-base dark:text-neutral-300 text-neutral-600"&amp;gt;Full-stack developer with a passion for turning code into seamless user experiences!&amp;lt;/p&amp;gt;
                        &amp;lt;button
                            class="mt-10 flex flex-row items-center gap-2 border border-gray-400 dark:border-gray-600 py-4 px-8 hover:border-purple-600 rounded-full hover:bg-purple-600 hover:text-white transition-all ease-in-out duration-300"&amp;gt;
                            Download CV
                            &amp;lt;i class="ri-arrow-right-up-line ri-xl"&amp;gt;&amp;lt;/i&amp;gt;

                        &amp;lt;/button&amp;gt;
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div class="w-full md:w-2/5 flex flex-row justify-center items-center"&amp;gt;
                        &amp;lt;img class="w-2/4 md:w-3/4 rounded-full"
                            src="https://www.anuraggharat.tech/images/anurag.jpg" /&amp;gt;

                        &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;


            &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EellVdg3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f6rmt591qhqluedipkw9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EellVdg3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f6rmt591qhqluedipkw9.png" alt="Image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Home Section&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  About Section
&lt;/h3&gt;

&lt;p&gt;The about section of the website will contain our personal details like education, history, interests, etc. It will also contain a list of skills for which we will use a pill shape design. Here, I am using my personal details; you can use yours.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- About Section --&amp;gt;
        &amp;lt;section class="w-full py-20 px-6 md:px-4" id="about"&amp;gt;
            &amp;lt;h1 class="text-4xl font-semibold"&amp;gt;About&amp;lt;/h1&amp;gt;
            &amp;lt;p class="mt-10 dark:text-gray-300"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Pariatur saepe fugiat nesciunt fuga.
                Maxime est nisi nulla inventore ab beatae maiores ipsum esse! Quibusdam blanditiis earum ratione harum
                incidunt
                vitae sunt cum officiis illum,
                qui vel totam consectetur voluptates enim voluptatum nemo, voluptatem porro ut sequi et vero quis
                cumque. Nulla
                inventore ab beatae maiores ipsum esse! Quibusdam blanditiis earum ratione harum incidunt
                vitae sunt cum officiis illum.
            &amp;lt;/p&amp;gt;
            &amp;lt;p class="mt-10 dark:text-gray-300"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Pariatur saepe fugiat nesciunt fuga.
                Maxime est nisi nulla inventore ab beatae maiores ipsum esse! Quibusdam blanditiis earum ratione harum
                incidunt
                vitae sunt cum officiis illum,
                qui vel totam consectetur voluptates enim voluptatum nemo, voluptatem porro ut sequi et vero quis
                cumque.
            &amp;lt;/p&amp;gt;
            &amp;lt;div class="flex flex-row justify-start gap-2 flex-wrap"&amp;gt;
                &amp;lt;ul class="text-sm flex flex-row gap-2 flex-wrap mt-10"&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out "&amp;gt;
                        HTML&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        CSS&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        SASS&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Bootstrap&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Tailwind CSS&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        JavaScript&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        TypeScipt&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        React&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Next.js&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Angular&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Express&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Node&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        MongoDB&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        MySQL&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Figma&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        Docker&amp;lt;/li&amp;gt;
                    &amp;lt;li
                        class="px-5 py-2 border border-gray-200 dark:border-gray-600 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                        AWS&amp;lt;/li&amp;gt;
                &amp;lt;/ul&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5u-KdXwA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Axxlrsv-TIEwhlLuG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5u-KdXwA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Axxlrsv-TIEwhlLuG.png" alt="image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;About section&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need realistic test data? Use our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/test-data-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Test Data Generator&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool to create realistic data for your testing needs. Get started now and save time and effort.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Work Experience Section
&lt;/h3&gt;

&lt;p&gt;This section includes details about your work history. We will create a simple one-column layout that will display details like place of work, duration, and tasks performed during that work period.&lt;/p&gt;

&lt;p&gt;To maintain the hierarchy among texts, we use different combinations of color and size. For example, the heading contains bold and dark &lt;em&gt;(.text-neutral-900)&lt;/em&gt; colored text, while the subheading has a lighter shade of grey &lt;em&gt;(.text-neutral-600)&lt;/em&gt; with normal size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- Work Experience section --&amp;gt;
&amp;lt;section class="w-full py-20"&amp;gt;
    &amp;lt;div class="mb-5 px-6 md:px-4"&amp;gt;
        &amp;lt;h1 class="text-4xl font-semibold mb-5"&amp;gt;Work Experience&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="flex flex-col p-6 md:p-4"&amp;gt;
        &amp;lt;div class="flex flex-row justify-between"&amp;gt;
            &amp;lt;div&amp;gt;
                &amp;lt;h3 class="text-2xl font-medium"&amp;gt;LTI-Mindtree&amp;lt;/h3&amp;gt;
                &amp;lt;p class="text-base font-medium text-gray-700 dark:text-gray-200"&amp;gt;Software Engineer&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;July 2021 - Now&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;ul class="text-base list-disc list-outside px-4 mt-2 font-light max-w-4xl dark:text-neutral-300 text-neutral-600"&amp;gt;
            &amp;lt;li&amp;gt;
                Working as a Back-end engineer in the Banking and Finance Sector.
            &amp;lt;/li&amp;gt;
            &amp;lt;li&amp;gt;Maintaining and adding new features to an Application Portal for an International Bank. Tech stack includes: Java, Spring, MySQL.&amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="flex flex-col p-6 md:p-4"&amp;gt;
        &amp;lt;div class="flex flex-row justify-between"&amp;gt;
            &amp;lt;div&amp;gt;
                &amp;lt;h3 class="text-2xl font-medium"&amp;gt;Edunomics&amp;lt;/h3&amp;gt;
                &amp;lt;p class="text-base font-medium text-gray-700 dark:text-gray-200"&amp;gt;Web Developer Intern&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;May 2020 - July 2020&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;ul class="text-base list-disc list-inside mt-2 font-light dark:text-neutral-300 text-neutral-600 max-w-4xl"&amp;gt;
            &amp;lt;li&amp;gt;
                Worked with the team for designing and developing products like Wenester.in and CxDeployer.
            &amp;lt;/li&amp;gt;
            &amp;lt;li&amp;gt;Single-handedly built and deployed websites like Edunomics.in and Tech.Edunomics.in Tech stack includes: React, Bootstrap, Node, Express, MongoDB.&amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IdRrCSK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AT5H0CHjT2QrNpBh3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IdRrCSK3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AT5H0CHjT2QrNpBh3.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Work Experience section&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Works/Projects Section
&lt;/h3&gt;

&lt;p&gt;This is the most important and highlighted section of the website. This section will contain images of all our projects along with the name, a short description, and a link to visit.&lt;/p&gt;

&lt;p&gt;To display these projects, we will create a 3-column layout consisting of cards. On small screens, we will collapse the 3-column layout into a single-column layout. We will add a hover animation where once the user hovers the mouse above the project, we will change the background color of the card and slightly move it to the top. This adds a 3D elevation effect to the card.&lt;/p&gt;

&lt;p&gt;For project images, you can use your own or find the images from the GitHub repository of this project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- Works section --&amp;gt;
&amp;lt;section class="w-full py-20" id="work"&amp;gt;
    &amp;lt;div class="mb-5 px-6 md:px-4"&amp;gt;
        &amp;lt;h1 class="text-4xl font-semibold mb-5"&amp;gt;Works&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="flex flex-col md:flex-row flex-wrap"&amp;gt;
        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222] rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="./amazon.jpg" class="rounded-lg" /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;Amazon Clone&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;A Full Stack Amazon clone application&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 flex flex-row items-center text-sm gap-2 rounded-full hover:text-purple-600"&amp;gt;
                &amp;lt;i class="ri-links-fill"&amp;gt;&amp;lt;/i&amp;gt;
                amazon.com
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222] rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="./facebook.jpg" class="rounded-lg" /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;Facebook Clone&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;A Full Stack Facebook clone application&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 flex flex-row items-center text-sm gap-2 rounded-full hover:text-purple-600"&amp;gt;
                &amp;lt;i class="ri-links-fill"&amp;gt;&amp;lt;/i&amp;gt;
                facebook.com
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222] rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="./spotify.png" class="rounded-lg" /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;Spotify Clone&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;A Full Stack Spotify clone application&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 flex flex-row items-center text-sm gap-2 rounded-full hover:text-purple-600"&amp;gt;
                &amp;lt;i class="ri-links-fill"&amp;gt;&amp;lt;/i&amp;gt;
                spotify.com
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222] rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="./netflix.jpg" class="rounded-lg" /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;Netflix Clone&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;A Full Stack Netflix clone application&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 flex flex-row items-center text-sm gap-2 rounded-full  hover:text-purple-600"&amp;gt;
                &amp;lt;i class="ri-links-fill"&amp;gt;&amp;lt;/i&amp;gt;
                netflix.com
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222] rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="./discord.png" class="rounded-lg" /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;Discord Clone&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;A Full Stack Discord clone application&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 flex flex-row items-center text-sm gap-2 rounded-full  hover:text-purple-600"&amp;gt;
                &amp;lt;i class="ri-links-fill"&amp;gt;&amp;lt;/i&amp;gt;
                discord.com
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222] rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="./airbnb.jpg" class="rounded-lg" /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;AirBnb Clone&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;A Full Stack AirBnb clone application&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 flex flex-row items-center text-sm gap-2 rounded-full hover:text-purple-600"&amp;gt;
                &amp;lt;i class="ri-links-fill"&amp;gt;&amp;lt;/i&amp;gt;
                airbnb.com
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tSlfBiop--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83fg24bq10mhx3mlrdt4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tSlfBiop--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83fg24bq10mhx3mlrdt4.png" alt="Image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Works section&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What I offer Section
&lt;/h3&gt;

&lt;p&gt;This mini section contains a 3-column layout displaying our services. The 3-column layout collapses into a single column on small screens. We will use our purple accent color for icons.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- What I offer section --&amp;gt;
&amp;lt;section class="w-full py-20"&amp;gt;
    &amp;lt;div class="mb-5 px-6 md:px-4"&amp;gt;
        &amp;lt;h1 class="text-4xl font-semibold mb-5"&amp;gt;What I offer&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="flex flex-col md:flex-row justify-between flex-wrap"&amp;gt;
        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4"&amp;gt;
            &amp;lt;i class="ri-paint-brush-line ri-3x text-purple-600"&amp;gt;&amp;lt;/i&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;UI/UX Design&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;Complete User Interface design of a website or an App.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4"&amp;gt;
            &amp;lt;i class="ri-quill-pen-line ri-3x text-purple-600"&amp;gt;&amp;lt;/i&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;Technical Writing&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;Writing blogs, guide, or any short content related to Tech.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4"&amp;gt;
            &amp;lt;i class="ri-terminal-box-line ri-3x text-purple-600"&amp;gt;&amp;lt;/i&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;Website Development&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;Developing a website from scratch with all the modern tools.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SaBaq-Yy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2geg6ni939s2xg5k6xth.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SaBaq-Yy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2geg6ni939s2xg5k6xth.png" alt="Image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What I offer section&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Blogs Section
&lt;/h3&gt;

&lt;p&gt;The blogs section will contain cards similar to the project section. We will add a read more button to make it look different from the project cards. We will implement the same elevation effect and 3-column layout as we did in the project card. For images, we will be using stock photos from &lt;a href="https://unsplash.com/"&gt;Unsplash&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- Blogs Section --&amp;gt;
&amp;lt;section class="w-full py-20" id="blogs"&amp;gt;
    &amp;lt;div class="p-6 md:p-4 mb-5"&amp;gt;
        &amp;lt;h1 class="text-4xl font-semibold mb-5"&amp;gt;Blogs&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="flex flex-row flex-wrap"&amp;gt;
        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222]  rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="https://images.pexels.com/photos/2440024/pexels-photo-2440024.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600" class="rounded-lg" /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;How to be more Productive at Work?&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;10 Tips on how to work done and be productive.&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 px-4 py-2 border border-gray-200 dark:border-gray-600 flex flex-row items-center text-sm gap-2 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                Read more
                &amp;lt;i class="ri-arrow-right-up-line ri-lg"&amp;gt;&amp;lt;/i&amp;gt;
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="flex flex-col items-start w-full md:w-1/3 p-6 md:p-4 hover:-translate-y-1 hover:bg-gray-100 dark:hover:bg-[#222]  rounded-lg transition-all duration-300 ease-in-out cursor-pointer"&amp;gt;
            &amp;lt;img src="https://images.pexels.com/photos/6224/hands-people-woman-working.jpg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"  class="rounded-lg"  /&amp;gt;
            &amp;lt;h1 class="text-xl font-medium mt-4"&amp;gt;How better designs help to solve problems&amp;lt;/h1&amp;gt;
            &amp;lt;p class="text-sm mt-2 dark:text-neutral-300 text-neutral-600"&amp;gt;Know about User Experience and how it helps to solve problems.&amp;lt;/p&amp;gt;
            &amp;lt;a href="#" target="_blank" rel="noopener noreferrer" class="mt-4 px-4 py-2 border border-gray-200 dark:border-gray-600 flex flex-row items-center text-sm gap-2 rounded-full hover:bg-purple-600 hover:text-white transition-all duration-300 ease-in-out"&amp;gt;
                Read more
                &amp;lt;i class="ri-arrow-right-up-line ri-lg"&amp;gt;&amp;lt;/i&amp;gt;
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;!-- Add the remaining blog entries with similar structure --&amp;gt;

    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xTYA3OZE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/goqzqrnn22cl7ts05dub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xTYA3OZE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/goqzqrnn22cl7ts05dub.png" alt="Image" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Blogs section&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Contact Section
&lt;/h3&gt;

&lt;p&gt;The contact section will be a 2-column layout which will contain contact details on one side and a contact form on the other side. We will have 3 rows, which will consist of 3 contact options.&lt;/p&gt;

&lt;p&gt;In the form, we will add a name, email input fields, message text area field, and a button to submit it. Similar to previous sections, on smaller screens, the 2-column layout will collapse into a single-column layout. We will add an accent color to the buttons and icons of this section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- Contact section --&amp;gt;
&amp;lt;section class="w-full py-20" id="contact"&amp;gt;
    &amp;lt;div class="p-6 md:p-4"&amp;gt;
        &amp;lt;h1 class="text-4xl font-semibold mb-5"&amp;gt;Contact&amp;lt;/h1&amp;gt;
        &amp;lt;p class="dark:text-neutral-300 text-neutral-600"&amp;gt;
            I would love to hear from you. Whether you have a question about my services, want to discuss a potential project, or simply want to say hello, don't hesitate to get in touch. I am here to help and excited to start a conversation.
        &amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="flex flex-col-reverse md:flex-row flex-wrap"&amp;gt;
        &amp;lt;div class="w-full md:w-1/2 flex flex-col flex-wrap justify-center gap-4"&amp;gt;
            &amp;lt;div class="w-full md:w-2/3 rounded-xl p-6 flex flex-col bg- gap-4"&amp;gt;
                &amp;lt;i class="ri-mail-line ri-xl text-purple-600"&amp;gt;&amp;lt;/i&amp;gt;
                &amp;lt;p&amp;gt;anuraggharat55@email.com&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="w-full md:w-2/3 rounded-xl p-6 flex flex-col bg- gap-4"&amp;gt;
                &amp;lt;i class="ri-phone-line ri-xl text-purple-600"&amp;gt;&amp;lt;/i&amp;gt;
                &amp;lt;p&amp;gt;+91-1010101010&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="w-full md:w-2/3 rounded-xl p-6 flex flex-col bg- gap-4"&amp;gt;
                &amp;lt;i class="ri-map-pin-line ri-xl text-purple-600"&amp;gt;&amp;lt;/i&amp;gt;
                &amp;lt;p&amp;gt;Mumbai - India.&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="flex flex-col justify-start items-start gap-4 w-full md:w-1/2 p-6 md:p-10"&amp;gt;
            &amp;lt;h2 class="font-medium text-xl"&amp;gt;Send me a Message&amp;lt;/h2&amp;gt;
            &amp;lt;input type="email" name="name" id="email"
                class="cursor-pointer block w-full border border-gray-300 dark:border-gray-600 rounded-xl bg-transparent py-4 px-6 text-gray-900
                        placeholder:text-gray-400 hover:border-gray-700 hover:dark:border-gray-300 focus:ring-0 sm:text-sm sm:leading-6"
                placeholder="Your Name" /&amp;gt;
            &amp;lt;input type="email" name="email" id="email"
                class="cursor-pointer block w-full border border-gray-300 dark:border-gray-600 rounded-xl bg-transparent py-4 px-6 text-gray-900
                        placeholder:text-gray-400 hover:border-gray-700 hover:dark:border-gray-300 focus:ring-0 sm:text-sm sm:leading-6"
                placeholder="Your Email" /&amp;gt;

            &amp;lt;textarea rows="3" name="message" id="message"
                class="cursor-pointer block w-full border border-gray-300 dark:border-gray-600 rounded-xl bg-transparent py-4 px-6 text-gray-900
                        placeholder:text-gray-400 hover:border-gray-700 hover:dark:border-gray-300 focus:ring-0 sm:text-sm sm:leading-6"
                placeholder="Your Message"&amp;gt;&amp;lt;/textarea&amp;gt;

            &amp;lt;button class="flex flex-row items-center gap-4 px-4 py-2 bg-purple-600 text-white rounded-lg text-lg"&amp;gt;
                Send
                &amp;lt;i class="ri-send-plane-2-line"&amp;gt;&amp;lt;/i&amp;gt;
            &amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jK3_rMdd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A4xa8k95s3GHwI-wE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jK3_rMdd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A4xa8k95s3GHwI-wE.png" alt="image" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Contact section&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Footer Component
&lt;/h3&gt;

&lt;p&gt;Our footer component will be placed at the bottom of the webpage. This component will have copyright text on one end and social media icons on the other. We will use flexbox to create this layout.&lt;/p&gt;

&lt;p&gt;We will change the background color and position of the icons on hover to add some hover animations. We will use our accent color in the hover effect on Icons. The icons are enclosed within &lt;em&gt;&amp;lt; a &amp;gt;&lt;/em&gt; tags. We will paste our social media link for the &lt;em&gt;href=”link”&lt;/em&gt; attribute of &lt;em&gt;&amp;lt; a &amp;gt;&lt;/em&gt; tags.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- footer section --&amp;gt;
&amp;lt;footer class="flex flex-col-reverse md:gap-0 gap-4 md:flex-row justify-between items-center w-full max-w-6xl border-t border-t-gray-300 py-10"&amp;gt;
    &amp;lt;p&amp;gt;
        &amp;amp;#169; 2023 anurag gharat
    &amp;lt;/p&amp;gt;
    &amp;lt;div class="flex flex-row gap-2 text-xl"&amp;gt;
        &amp;lt;a href="http://" target="_blank" rel="noopener noreferrer" class="flex flex-row justify-center items-center w-12 h-12 border-[1px] border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-[#222] rounded-full hover:bg-purple-600 hover:text-white hover:-translate-y-2
            transition-all ease-in-out duration-300 "&amp;gt;
            &amp;lt;i class="ri-facebook-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/a&amp;gt;
        &amp;lt;a href="http://" target="_blank" rel="noopener noreferrer" class="flex flex-row justify-center items-center w-12 h-12 border-[1px] border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-[#222] rounded-full hover:bg-purple-600 hover:text-white hover:-translate-y-2
            transition-all ease-in-out duration-300 "&amp;gt;
            &amp;lt;i class="ri-twitter-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/a&amp;gt;
        &amp;lt;a href="http://" target="_blank" rel="noopener noreferrer" class="flex flex-row justify-center items-center w-12 h-12 border-[1px] border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-[#222] rounded-full hover:bg-purple-600 hover:text-white hover:-translate-y-2
            transition-all ease-in-out duration-300 "&amp;gt;
            &amp;lt;i class="ri-instagram-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/a&amp;gt;
        &amp;lt;a href="http://" target="_blank" rel="noopener noreferrer" class="flex flex-row justify-center items-center w-12 h-12 border-[1px] border-gray-300 dark:border-gray-600 hover:bg-purple-600 bg-gray-200 dark:bg-[#222] rounded-full hover:text-white hover:-translate-y-2
            transition-all ease-in-out duration-300 "&amp;gt;
            &amp;lt;i class="ri-youtube-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/a&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/footer&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UUxe1Yfp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sutwy066bpxsye05x8gq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UUxe1Yfp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sutwy066bpxsye05x8gq.png" alt="Image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Footer section&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Menu List Toggle Component
&lt;/h3&gt;

&lt;p&gt;We have now finished the styling for all the website sections. All the sections are responsive for all screen sizes except the navbar. Let’s start by understanding the logic behind the behavior of our navbar.&lt;/p&gt;

&lt;p&gt;For larger screens, we have our horizontally placed links inside our navbar with logo and theme switch buttons on either side. This is the ideal or normal state of our navbar.&lt;/p&gt;

&lt;p&gt;Here are the steps we will follow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Display the links horizontally on larger screens and hide them on smaller ones.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new drop-down component for the links.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a menu button in place of the links on smaller screens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display the drop-down links component when the user clicks on the menu button.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XaJU4iXl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Aq3gvs-Wb1SmG7-ja.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XaJU4iXl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Aq3gvs-Wb1SmG7-ja.png" alt="image" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Navbar in normal state&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s start with Step 1. To hide the links on smaller screens, we will use Tailwind CSS breakpoint modifiers. In the &lt;em&gt;&amp;lt; ul &amp;gt;&lt;/em&gt; element of the links component, add a class of &lt;em&gt;.hidden&lt;/em&gt; and modify the &lt;em&gt;.flex&lt;/em&gt; class to &lt;em&gt;.md:flex&lt;/em&gt;. This hides the menu links on smaller screens &lt;em&gt;(&amp;lt;786px)&lt;/em&gt; and unhides them on bigger screens &lt;em&gt;(&amp;gt;786px)&lt;/em&gt;&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;!--Links component - Visible on large screens and not on small screens -–&amp;gt;

&amp;lt;ul class="hidden md:flex (..all other classes)"&amp;gt;

&amp;lt;!--Links -–&amp;gt;

&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4WHkYgV3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbtxkozxlwbotpespnd0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4WHkYgV3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbtxkozxlwbotpespnd0.png" alt="Image" width="600" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, for Step 2, let’s create a copy of the original links component. This will be the same as the original, but instead of &lt;em&gt;.flex-row&lt;/em&gt;, we will use the &lt;em&gt;.flex-col&lt;/em&gt; class to make the links vertical.&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;ul
id="menu-list"
 class="flex flex-col items-center text-sm md:text-base gap-4
 md:gap-10 dark:border-gray-600 dark:text-white
 rounded-sm p-6 md:px-10 w-full h-auto bg-white dark:bg-[#121212]
 transition-all duration-500 ease-out"&amp;gt;
&amp;lt;li&amp;gt;
&amp;lt;a href="#" rel="noopener noreferrer"  class="hover:text-purple-600"&amp;gt;Home&amp;lt;/a&amp;gt;
&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;
&amp;lt;a href="#about" rel="noopener noreferrer"   class="hover:text-purple-600"&amp;gt; About&amp;lt;/a&amp;gt;
&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;
&amp;lt;a href="#work" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;Work&amp;lt;/a&amp;gt;
&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;
&amp;lt;a href="#blogs" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;Blogs&amp;lt;/a&amp;gt;
&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;
&amp;lt;a href="#contact" rel="noopener noreferrer" class="hover:text-purple-600"&amp;gt;Contact&amp;lt;/a&amp;gt;
&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of a simple hide-show effect, we will add a slide-down effect to this component whenever we click the button. For this, we will first push the component at the top outside the viewport. Then, once the user clicks the button, we will return it to the viewport. This will create a nice animation of sliding in and out.&lt;/p&gt;

&lt;p&gt;To achieve the slide-down effect, we will use placement and position classes from Tailwind. We will add a &lt;em&gt;.fixed&lt;/em&gt; class to fix our links in one place and then push it outside the viewport using the &lt;em&gt;.-top-80&lt;/em&gt; and &lt;em&gt;.right-0&lt;/em&gt; classes. Due to the negative value links will be above the visible viewport and hence hidden to the user.&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;!-- Drop Down component for Links (Not visible on Large screens) --&amp;gt;
&amp;lt;ul
id="menu-list"
class="fixed flex -top-80 right-0 flex-col items-center text-sm ..
&amp;lt;!-- Code for links 

--&amp;gt;

&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make these links visible to the user we will change the &lt;em&gt;.-top-80&lt;/em&gt; class to &lt;em&gt;.top-20&lt;/em&gt; class with the help of JavaScript. We will create a JavaScript function that will perform this task of changing the classes. Before writing the JavaScript, let’s create the menu button.&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;button class="flex md:hidden bg-white w-12 h-12 md:w-16 md:h-16 flex-row justify-center items-center border-gray-300 dark:border-gray-600 dark:bg-[#121212] dark:text-white border rounded-full"&amp;gt;
    &amp;lt;i id="menu-toggler" class="ri-menu-line ri-xl"&amp;gt;&amp;lt;/i&amp;gt;
&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This button will be displayed on the right of theme switch button only on small screens. On large screens, we will hide it using the &lt;em&gt;.hidden&lt;/em&gt; class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZTDpQQ6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A-GVaUsUvuUO8uCLl.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZTDpQQ6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A-GVaUsUvuUO8uCLl.gif" alt="image" width="600" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s write a &lt;em&gt;toggleMenu()&lt;/em&gt; function to add functionality to the drop-down list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html:&lt;/em&gt;&lt;/strong&gt;&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;script&amp;gt;

//toggle menu on small screens
function toggleMenu() {
    //create variables for button and list
    const menuButton = document.getElementById('menu-toggler');
    const menuList = document.getElementById('menu-list');

    //toggle class to bring menu inside viewport
    menuList.classList.toggle('-top-80');
    menuList.classList.toggle('top-20');

    //toggle class to change menu icon to cross icon
    menuButton.classList.toggle('ri-menu-line');
    menuButton.classList.toggle('ri-close-line');
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above &lt;em&gt;toggleMenu()&lt;/em&gt; function toggles between the &lt;em&gt;.-top-80&lt;/em&gt; and &lt;em&gt;top-20&lt;/em&gt; classes. Along with replacing the classes for the menu list, the function also changes the icon for the toggler button.&lt;/p&gt;

&lt;p&gt;By default, we will show a three-horizontal line menu icon. Once the drop-down menu is visible, we will show a cross icon. The &lt;em&gt;toggleMenu()&lt;/em&gt; function is attached to the &lt;em&gt;onclick=””&lt;/em&gt; handler of the menu button.&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;button
    onclick="toggleMenu()"
    class="flex md:hidden bg-white w-12 h-12 md:w-16 md:h-16 flex-row justify-center items-center border-gray-300 dark:border-gray-600 dark:bg-[#121212] dark:text-white border rounded-full"&amp;gt;
    &amp;lt;i id="menu-toggler" class="ri-menu-line ri-xl"&amp;gt;&amp;lt;/i&amp;gt;
&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Final Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lN3mOEvJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wgimbu72hnb8gvtre4ez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lN3mOEvJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wgimbu72hnb8gvtre4ez.png" alt="Image" width="600" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Menu Toggle button on small screens&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need random text for your project? Our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/lorem-ipsum-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Lorem Ipsum Generator&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;lets you easily generate filler text. Choose the number of paragraphs, words, or characters you need.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Theme Switcher feature
&lt;/h3&gt;

&lt;p&gt;Now, with all the components and sections of our website setup, let’s create a dark mode feature. Dark mode in websites and user interfaces is important because it reduces eye strain, saves device battery, improves accessibility, and offers a modern look. All modern websites and apps support the dark mode feature, where the user can choose between the light and dark mode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5OTtYtsT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nf1axu6kbfuu4ofkjh58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5OTtYtsT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nf1axu6kbfuu4ofkjh58.png" alt="Image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Light mode&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K-aek2le--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2Nsp-Qtllv2lQKpY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K-aek2le--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2Nsp-Qtllv2lQKpY.png" alt="image" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Dark mode&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Currently, our website uses the user’s system preference for setting up the website theme. Hence, if you use a browser with a light mode preference, all the light mode classes will be activated, and you will see a light mode website on your browser. But if your preference is set to dark, the website will automatically activate dark variants of the classes, and a dark mode website will be shown to you.&lt;/p&gt;

&lt;p&gt;Along with this automatic switching, we also want to add a manual switch to toggle between themes. For this, we first need to modify the Tailwind configuration file. Open your &lt;em&gt;tailwind.config.js&lt;/em&gt; file and add &lt;em&gt;darkMode: “class”&lt;/em&gt; line inside the &lt;em&gt;module.exports&lt;/em&gt; object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;tailwind.config.js:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/** @type {import('tailwindcss').Config} */
module.exports = {
    darkMode: "class",
    content: ["./src/**/*.{html,js}"],
    theme: {
       extend: {},
    },
    plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3_8jVIUI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91ow8l6yyt8qd981zrao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3_8jVIUI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91ow8l6yyt8qd981zrao.png" alt="Image" width="800" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Moon icon in light mode&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nf0bOQ2_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7jeyls1h2atnqx9ci6z1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nf0bOQ2_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7jeyls1h2atnqx9ci6z1.png" alt="Image" width="800" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sun icon in dark mode&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For the theme switch button, we will have two variations in the form of icons. A Sun icon will be used in the dark mode and act as a button to switch to light mode. Similarly, a Moon icon will be used in the light mode and act as a button to switch to dark mode.&lt;/p&gt;

&lt;p&gt;Now, let’s write some JavaScript code to toggle the dark classes based on the user’s preference and at the click of a button.&lt;/p&gt;

&lt;p&gt;These are the three functionalities that we need for our feature.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Set an initial theme based on the user system preference value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allow manual switching between dark and light modes using a button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change the Icon used for the button to differentiate between both modes.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We create three JavaScript functions to handle these three functionalities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;index.html:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// JavaScript for Menu togglers and Dark Mode functionality

// initialize variables for icons
const moonIcon = document.querySelector('#theme-toggler-moon');
const sunIcon = document.querySelector('#theme-toggler-sun');

// function to toggle the state of icons
function toggleIcons() {
    moonIcon.classList.toggle('hidden');
    sunIcon.classList.toggle('hidden');
}

// set initial theme based on local storage and user preference
function setInitialTheme() {
    if (localStorage.getItem('theme') === 'dark' || (!('theme' in localStorage) &amp;amp;&amp;amp; window.matchMedia('(prefers-color-scheme: dark)').matches)) {
        document.documentElement.classList.add('dark');
        moonIcon.classList.add('hidden');
        localStorage.setItem('theme', 'dark');
    } else {
        document.documentElement.classList.remove('dark');
        sunIcon.classList.add('hidden');
        localStorage.setItem('theme', 'light');
    }
}

// toggle theme manually
function toggleTheme() {
    if (localStorage.theme === 'dark') {
        document.documentElement.classList.remove('dark');
        localStorage.theme = 'light';
        toggleIcons();
    } else {
        document.documentElement.classList.add('dark');
        localStorage.theme = 'dark';
        toggleIcons();
    }
}

// calling function to set initial theme
setInitialTheme();
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before we test, let’s add a Moon icon inside the button tag of the theme toggler button. Now, our theme toggler button will contain two icons. With the help of the JavaScript code we wrote earlier, we will toggle one based on the current theme.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;button onclick="toggleTheme()" class="flex bg-white w-12 h-12 md:w-16 md:h-16 flex-row justify-center items-center border-gray-300 dark:border-gray-600 dark:bg-[#121212] dark:text-white border rounded-full"&amp;gt;
    &amp;lt;i id="theme-toggler-sun" class="ri-sun-fill text-yellow-400 ri-xl" id="sun-icon"&amp;gt;&amp;lt;/i&amp;gt;
    &amp;lt;i id="theme-toggler-moon" class="ri-moon-clear-line text-blue-800 ri-xl" id="sun-icon"&amp;gt;&amp;lt;/i&amp;gt;
&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Theme toggler&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Responsive Testing
&lt;/h3&gt;

&lt;p&gt;Before we finish our demo, let’s test if our website is responsive across all devices. For &lt;a href="https://www.lambdatest.com/learning-hub/responsive-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive testing&lt;/a&gt;, we will be using the LT Browser by LambdaTest. &lt;a href="https://www.lambdatest.com/lt-browser/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;LT Browser&lt;/a&gt; allows us to test our website on 50+ device viewports, including smartphones, tablets, and desktops. The inbuilt performance analyzer makes it easy to analyze the performance metrics of our website.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/rqFeuaZ-wAY"&gt;
&lt;/iframe&gt;
 &lt;/p&gt;

&lt;p&gt;Catch up with the latest tutorials on &lt;a href="https://www.lambdatest.com/mobile-app-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;mobile app testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/real-device-cloud?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;real device testing&lt;/a&gt;, and more — Subscribe to the &lt;a href="https://www.youtube.com/c/LambdaTest?sub_confirmation=1"&gt;LambdaTest YouTube Channel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before testing, follow the best practices below to improve your score.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add &lt;em&gt;alt&lt;/em&gt; property for all &lt;em&gt;&amp;lt; img &amp;gt;&lt;/em&gt; elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set &lt;em&gt;loading=’lazy’&lt;/em&gt; to all &lt;em&gt;&amp;lt; img &amp;gt;&lt;/em&gt; elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;em&gt;webp&lt;/em&gt; image format instead of &lt;em&gt;png&lt;/em&gt; and &lt;em&gt;jpeg&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add all the necessary meta tags in &lt;em&gt;&amp;lt; head &amp;gt;&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, let’s test our website on different device viewports. I am choosing a desktop and mobile phone to check if my website is responsive simultaneously.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MbU9JwKv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9alljifhd6vrbqi4k8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MbU9JwKv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9alljifhd6vrbqi4k8h.png" alt="Image" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Responsiveness testing of website&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Similarly, let’s check our website performance report.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lOpq_sxt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrg8jftlzco1t3phl0t3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lOpq_sxt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrg8jftlzco1t3phl0t3.png" alt="Image" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Performance report&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can further increase your website performance by adding PWA functionality and accessibility practices.&lt;/p&gt;

&lt;p&gt;With that, we finished our demo of the Developer Portfolio website. We completed the entire design using Tailwind classes without writing any CSS code. This website is responsive across all devices and supports the dark mode feature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Take on Tailwind CSS
&lt;/h3&gt;

&lt;p&gt;In my opinion, Tailwind is one of the best frameworks for CSS out there and can be used almost everywhere. But then, should we use it everywhere?&lt;/p&gt;

&lt;p&gt;Well, it depends. Tailwind will work great for the majority of the use cases. It is a perfect fit for web applications where the developer needs more control over the styling and is ready to spend enough time creating and customizing the components from scratch.&lt;/p&gt;

&lt;p&gt;But in the case of applications where styling is not a big factor and developers don’t want to spend time creating components from scratch, Tailwind might not be the ideal solution.&lt;/p&gt;

&lt;p&gt;Tailwind could be a great alternative to writing your own CSS. It will speed up your development process. Also, it is fast! Tailwind generates an output file for only the classes that we use. Hence, we only ship the CSS code that we use.&lt;/p&gt;

&lt;p&gt;At the core, Tailwind CSS is nothing but regular CSS in the form of classes. Hence, having a thorough knowledge of CSS skills is essential. Tailwind CSS has almost all the CSS properties we need for your project. In addition, if we want anything extra, you can always extend and customize it as per our needs.&lt;/p&gt;

&lt;p&gt;While it might take some time to get used to Tailwind CSS in the beginning, the payoff for the efforts is worth it!&lt;/p&gt;

&lt;p&gt;So, should we learn Tailwind CSS? Yes absolutely! Tailwind CSS is one of the hottest technologies in the market, and many organizations use it. Hence, knowing Tailwind CSS could be a huge bonus for your career.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tailwind CSS vs Bootstrap: What’s the Difference?
&lt;/h3&gt;

&lt;p&gt;Tailwind CSS vs. &lt;a href="https://www.lambdatest.com/blog/bootstrap-buttons-badges/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=dec_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;Bootstrap&lt;/a&gt;: which one’s better? It is the most popular argument on the internet. Let’s first understand the main differences between both and what points you should consider while choosing one for your next project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PX8vsty8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypumthux32knmilltz2q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PX8vsty8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypumthux32knmilltz2q.png" alt="Image" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Bootstrap&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Bootstrap is a popular component-based CSS framework for creating fast and responsive websites. Bootstrap comes with predefined component classes that can be used to create components like cards, navbars, and forms. This makes the website styling process easy and fast because all the components are preconfigured. However, since the components are prebuilt, the level of customization is low. All the components carry fixed styling, which might not go with all UI designs.&lt;/p&gt;

&lt;p&gt;Whereas, in Tailwind, you have plenty of utility classes to customize your application. You are not confined within the styles already provided by the framework. You have plenty of options even if you don’t have a suitable style. You can always extend it.&lt;/p&gt;

&lt;p&gt;Bootstrap has certain limits to customization and offers less flexibility than Tailwind CSS. Bootstrap also generates a large output file by default consisting of all the CSS and JavaScript code, whether we use it or not. This can affect the performance of the website.&lt;/p&gt;

&lt;p&gt;But then how do you choose? See, the answer to this question is pretty simple. If, as a developer, you want something that is quick to set up and comes with components already built for you. Go with Bootstrap! Bootstrap will save a lot of time because it will handle a lot of UI-side things behind the scenes.&lt;/p&gt;

&lt;p&gt;If you want customization and freedom to style however you want, go for Tailwind CSS. You will have to build everything from scratch, but then you will have more control over the styling of your website.&lt;/p&gt;

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

&lt;p&gt;That’s a wrap for this blog. Thank you for reading. I hope this blog helped you get familiar with Tailwind CSS and how to use it in a project. In this blog, we explored Tailwind CSS, why we need it, and how to use it. In the end, we also created a beautiful Portfolio website using Tailwind, which you can use as your personal Developer Portfolio.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this tutorial and are now comfortable creating your websites using Tailwind CSS. So go ahead and show your creativity.&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>css</category>
      <category>automationtesting</category>
      <category>softwaretesting</category>
    </item>
    <item>
      <title>An Intuitive Guide To CSS Glassmorphism</title>
      <dc:creator>Anuraggharat651</dc:creator>
      <pubDate>Tue, 27 Jun 2023 07:29:15 +0000</pubDate>
      <link>https://dev.to/anuraggharat651/an-intuitive-guide-to-css-glassmorphism-4id9</link>
      <guid>https://dev.to/anuraggharat651/an-intuitive-guide-to-css-glassmorphism-4id9</guid>
      <description>&lt;p&gt;Glassmorphism is the newest addition to the &lt;a href="https://www.lambdatest.com/blog/web-design-trends/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;web design trends&lt;/a&gt; and is getting increasingly popular in the community. Even If you haven’t heard about it, the chances are that you’ve come across it and used it somewhere.&lt;/p&gt;

&lt;p&gt;Using Glassmorphism can help create amazing digital experiences. Combined with colorful images and shapes, transparency and blurred backgrounds make Glassmorphism more eye-catching. Adding frost and translucent elements to designs adds depth and dimension and makes the user experience more immersive and engaging. — top tech giants like Apple, Microsoft use Glassmorphism in their products.&lt;/p&gt;

&lt;p&gt;If you have an iPhone or iPad, go to your home screen or open your notifications panel, or if you use a Windows machine, go to the Start menu. Do you notice the frosted glass effect around the menu and widgets? That’s &lt;strong&gt;Glassmorphism&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;Get ready for your &lt;a href="https://www.lambdatest.com/learning-hub/mocha-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_27&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;Mocha interview questions&lt;/a&gt; with our expert-curated list of Mocha interview questions tips. Impress your potential employer and land your dream job.&lt;/p&gt;

&lt;p&gt;An Example of Glassmorphism on iOS in Apple products.&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-images-1.medium.com%2Fmax%2F800%2F0%2ARAZu4FkNML_4jWBh.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-images-1.medium.com%2Fmax%2F800%2F0%2ARAZu4FkNML_4jWBh.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An Example of Glassmorphism on Windows 11 in Microsoft products.&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-images-1.medium.com%2Fmax%2F800%2F0%2A_hT4RNU-GhM4g3n3.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-images-1.medium.com%2Fmax%2F800%2F0%2A_hT4RNU-GhM4g3n3.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Glassmorphism is a UI design style that uses transparency and background blur to achieve a glass-like effect in UI. This glass effect is further enhanced by placing the UI elements over highly vivid backgrounds. This effect is often termed the “Frosted Glass Effect”.&lt;/p&gt;

&lt;p&gt;Glassmorphism design style got popular in late 2021 when Michal Malewicz, who also introduced the Neumorphism UI design style, wrote an article where he combined all the frosted glass effect styles under one name — “Glassmorphism.”&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I created Neumorphism, Glassmorphism, Neubrutalism and a couple others because I'm curious and noticing things around me.  &lt;/p&gt;

&lt;p&gt;I noticed a shift in the UI styles again and it's time to start digging deeper into it.  &lt;/p&gt;

&lt;p&gt;.com already purchased 😎&lt;/p&gt;

&lt;p&gt;— Michal Malewicz (@michalmalewicz) &lt;a href="https://twitter.com/michalmalewicz/status/1579163678850842624?ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;October 9, 2022&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this guide on CSS Glassmorphism, we will learn about Glassmorphism, a little history behind it, and how we can achieve the effect using CSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Boost your testing skills with&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/pytest-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_27&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Pytest interview questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;. Beginner, intermediate, and advanced levels covered. Prepare and excel in your interviews.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Glassmorphism?
&lt;/h3&gt;

&lt;p&gt;Glassmorphism UI contains cards with a frosted glass effect, floating freely on colorful and vivid backgrounds. The main highlight of this design style is the frosted glass texture and depth achieved with the help of layers.&lt;/p&gt;

&lt;p&gt;The Glassmorphism effect enables designers to combine layers using the glass effect while still retaining a distinct separation between separate subjects. This design style is commonly seen in dashboards, smartphone UIs, and mobile apps. Popular brands like Apple and Microsoft already use it in their design system.&lt;/p&gt;

&lt;p&gt;Let’s see how Microsoft and Apple use Glassmorphism in their Windows 11.&lt;/p&gt;

&lt;p&gt;Microsoft uses a frosted glass effect in Windows 11. You can notice the blur effect in the Start menu, Taskbar, Settings menu, Notification boxes, and some Microsoft apps. Microsoft included this blur effect in their fluent design system under the name “Acrylic.”&lt;/p&gt;

&lt;p&gt;Acrylic is a fluent design system component that adds physical texture and depth to your app design using the blur effect. Microsoft uses this Acrylic effect in its Windows 11 user interface and some Microsoft applications.&lt;/p&gt;

&lt;p&gt;In the case of Apple, iOS, and macOS have been using the glass effect in their UI. Take a look at this control center on macOS Big Sur. The glass effect is clearly visible in the design of the controls. You can notice a similar glass effect in the App Drawer, Notifications, Widgets, etc.&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-images-1.medium.com%2Fmax%2F800%2F0%2AwIxxNqlaOCVLI5UE.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-images-1.medium.com%2Fmax%2F800%2F0%2AwIxxNqlaOCVLI5UE.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Further, this glass effect is also implemented in iOS. Take a look at this design of notifications on an iPhone lock screen. This design looks aesthetically pleasing and easy for users to interact with.&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-images-1.medium.com%2Fmax%2F800%2F0%2ANOjJYbxVF2Og6U_s.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-images-1.medium.com%2Fmax%2F800%2F0%2ANOjJYbxVF2Og6U_s.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Glassmorphism is quite common in Operating System UIs and Android / iOS applications. But recently, with the increased support for the &lt;strong&gt;backdrop-filter&lt;/strong&gt; property in CSS, many websites are moving to CSS Glassmorphism design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Ace your QA interviews with our comprehensive guide on 60+&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/specflow-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_27&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;SpecFlow Interview Questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;and Answers. Boost your BDD knowledge and showcase your SpecFlow expertise.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here are some popular websites using CSS Glassmorphism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Design + Code&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2AwRynb7Jn_RWBHf15.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-images-1.medium.com%2Fmax%2F800%2F0%2AwRynb7Jn_RWBHf15.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Amazon Music&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2AlmmF4EXTw38V-0EL.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-images-1.medium.com%2Fmax%2F800%2F0%2AlmmF4EXTw38V-0EL.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, I have used LT Browser 2.0 — a complementary tool by LambdaTest to render the websites.&lt;/p&gt;

&lt;p&gt;LT Browser 2.0 is a Chromium-based &lt;a href="https://www.lambdatest.com/mobile-friendly-test?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;mobile-friendly tester&lt;/a&gt; offered by LambdaTest — a continuous quality cloud testing platform for manual and &lt;a href="https://www.lambdatest.com/automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;automation testing&lt;/a&gt; for web and mobile. With LT Browser 2.0, you can test your website’s responsiveness on over 50+ device viewports. It supports &lt;a href="https://www.lambdatest.com/learning-hub/responsive-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;responsive testing&lt;/a&gt; on the mobile, tablet, desktop, and even laptops.&lt;/p&gt;

&lt;p&gt;The main strength of CSS Glassmorphism design is the balance of Blur, Transparency, Backgrounds, and borders.&lt;/p&gt;

&lt;h3&gt;
  
  
  History of Glassmorphism
&lt;/h3&gt;

&lt;p&gt;Surprisingly, the Glassmorphism design trend in UI Design is not new. It first appeared in the year 2013 on iOS 7 and Windows Vista. Remember the transparent Windows menu? Yes, that was the first instance of Glassmorphism.&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-images-1.medium.com%2Fmax%2F800%2F0%2AqVoVJ7G9ncQJnviu.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-images-1.medium.com%2Fmax%2F800%2F0%2AqVoVJ7G9ncQJnviu.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During those days, there were a lot of accessibility and readability issues, so it was slowly removed with the next updates. After almost eight years, in 2021, Apple reintroduced Glassmorhphism with the launch of the Big Sur update for macOS. Microsoft also came up with its Glassmorphism design on Windows 11 update in the same year.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/SdcyDZbFYFU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Since then, it has regained popularity and got every designer talking about it. It became one of the most popular &lt;a href="https://www.lambdatest.com/blog/20-elements-of-modern-web-design/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;modern web design trends&lt;/a&gt;, so many products started incorporating it into their design system.&lt;/p&gt;

&lt;p&gt;Here are some popular CSS Glassmorphism designs on Dribbble.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Creative Cloud App Redesign by Mikołaj Gałęziowski.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sidebar Menu Design by Anton Olashyn&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Messenger app by Mikołaj Gałęziowski&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cryptocurrency Website by Azie Melasari&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Characteristics of CSS Glassmorphism
&lt;/h3&gt;

&lt;p&gt;In this section, we will explore the characteristics of CSS Glassmorphism.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Translucency&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Vivid backgrounds&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hierarchy using Shadows and Light Borders&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When combined in the right proportion, the above effects create a beautiful and visually appealing Glassmorphism effect that can make any user an instant fan.&lt;/p&gt;

&lt;p&gt;Now that we know the characteristics of Glassmorphism, let us look at how to create this effect using CSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Here’s Top 30&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/robot-framework-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_27&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Robot Framework Interview Questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;and Answers that will help you boost your confidence in an Interview.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating Glassmorphism Using CSS
&lt;/h3&gt;

&lt;p&gt;Glassmorphism is very easy to create using CSS. The main idea behind Glassmorphism is to create Glass panels on a colorful background. This Glass effect is achieved using &lt;a href="https://www.lambdatest.com/blog/fixing-browser-compatibility-issues-with-css-opacity-rgba/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;CSS Opacity&lt;/a&gt; and &lt;strong&gt;backdrop-filter&lt;/strong&gt; properties.&lt;/p&gt;

&lt;p&gt;Following are the steps to achieve CSS Glassmorphism:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add a vivid background to the root element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apply an opacity to the object in focus.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a background blur using the &lt;strong&gt;backdrop-filter&lt;/strong&gt; property.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a light border and border radius.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apply shadow using the &lt;a href="https://www.lambdatest.com/blog/css-box-shadow/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;CSS Box Shadow&lt;/a&gt; property.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using the above steps, let’s create a simple Credit card effect shown below.&lt;/p&gt;

&lt;p&gt;We will first create our entire structure using HTML and CSS and then move to the Glassmorphism effect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;


&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;CSS GlassMorphism Card&amp;lt;/title&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
    &amp;lt;link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
    &amp;lt;link rel="stylesheet" href="./style.css"&amp;gt;
    &amp;lt;link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet"&amp;gt;
&amp;lt;/head&amp;gt;


&amp;lt;body&amp;gt;
    &amp;lt;section&amp;gt;
        &amp;lt;div class="circle-1"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="circle-2"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="circle-3"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="card"&amp;gt;
            &amp;lt;div&amp;gt;
                &amp;lt;h1&amp;gt;ANURAG GHARAT&amp;lt;/h1&amp;gt;
                &amp;lt;p&amp;gt;1892 1232 1242 0099&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;
                07/27
            &amp;lt;/p&amp;gt;
                &amp;lt;i class="ri-visa-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
    box-sizing: border-box;
    padding: 0px;
    margin: 0px;
}
body {
    width: 100%;
    height: 100%;
    background: #fff;
    font-family: 'Noto Sans', sans-serif;
    background: #0f0c29; 
    background: -webkit-linear-gradient(to right, #24243e, #302b63, #0f0c29); 
    background: linear-gradient(to right, #24243e, #302b63, #0f0c29); 
}
section {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}
.circle-1 {
    position: absolute;
    top: 15%;
    left: 30%;
    background: #4776E6;
    background: -webkit-linear-gradient(to right, #8E54E9, #4776E6);
    background: linear-gradient(to right, #8E54E9, #4776E6);   
    height: 350px;
    width: 350px;
    border-radius: 50%;
}
.circle-2{
    position: absolute;
    bottom: 5%;
    right: 35%;
    background: #bc4e9c;
    background: -webkit-linear-gradient(to right, #f80759, #bc4e9c);
    background: linear-gradient(to right, #f80759, #bc4e9c);
    height: 400px;
    width: 400px;
    border-radius: 50%;
}
.circle-3 {
    position: absolute;
    top: 30%;
    right: 35%;
    background-color: #FF3CAC;
    background: #ff9966;
    background: -webkit-linear-gradient(to right, #ff5e62, #ff9966);
    background: linear-gradient(to right, #ff5e62, #ff9966);
    height: 150px;
    width: 150px;
    border-radius: 50%;
}
.card {
    height: 300px;
    width: 500px;
    border-radius: 20px;
    background: rgba(255,255,255);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    color: #fff;


}
.card &amp;gt; i {
    position: absolute;
    top: 10%;
    right: 10%;
    font-size: 2.5rem;
}
.card &amp;gt; div &amp;gt; p {
    letter-spacing: 3px;
    word-spacing: 10px;
    margin-top: 10px;
    font-size: 28px;
    font-family: 'Courier New', Courier, monospace;
}


.card &amp;gt; p {
    position: absolute;
    bottom: 10%;
    fill: #fff;
    letter-spacing: 3px;
    word-spacing: 10px;
    margin-top: 10px;
    font-size: 20px;
}


.card&amp;gt;div&amp;gt;h1 {
    font-weight: lighter;
    font-size: 16px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2A8gYanFr24HDXmbqs.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-images-1.medium.com%2Fmax%2F800%2F0%2A8gYanFr24HDXmbqs.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I used a dark gradient background and, upon that, added some colored circles to add depth. I have used the &lt;strong&gt;position: absolute&lt;/strong&gt; property in CSS to position the objects. I have placed the objects exactly behind the card so that when we add the frosted glass effect, these colored objects will be partially visible. I have used an online tool called WebGradients for generating gradient background color.&lt;/p&gt;

&lt;p&gt;For styling the card, I aligned the card perfectly at the center using &lt;a href="https://www.lambdatest.com/blog/css-flexbox-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;CSS Flexbox&lt;/a&gt; and used remix icons for the VISA icon shown on top. Currently, I have added a black background to the card, but we will change it in the next steps.&lt;/p&gt;

&lt;p&gt;Regarding the root section’s background, you can go with any primary pastel color or mesh gradient background. Choose one which suits your project requirement and goes well with the frosted glass effect.&lt;/p&gt;

&lt;p&gt;The blur effect in CSS is achieved using the &lt;strong&gt;backdrop-filter&lt;/strong&gt; property. This property is used to apply graphical effects such as blurring, color shifting, or inverting the background.&lt;/p&gt;

&lt;p&gt;In our case, &lt;strong&gt;backdrop-filter: blur(40px)&lt;/strong&gt; applies a blur to the element’s background. Let’s add this property to the .card element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This questionnaire of&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/jasmine-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_27&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;Jasmine Interview questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;will aid you in giving good insight about Jasmine and how to crack the interview.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.card {
    /* other styles */
    backdrop-filter: blur(40px);
    /* fallback cross browser compatibility */
    -webkit-backdrop-filter: blur(40px);


}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2APcyRFS701fIDzfyi.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-images-1.medium.com%2Fmax%2F800%2F0%2APcyRFS701fIDzfyi.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, there is no change to the card. This is because the card still needs to be transparent. The &lt;strong&gt;backdrop-filter&lt;/strong&gt; property is combined with opacity to provide that partial transparency effect. Let’s decrease the opacity of our card.&lt;/p&gt;

&lt;p&gt;To decrease the opacity, you can use the &lt;strong&gt;opacity&lt;/strong&gt; property separately or the &lt;strong&gt;rgba()&lt;/strong&gt; input type for the background property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.card {
    /* other styles */
    background: rgba(39, 39, 39, 0.1);
    backdrop-filter: blur(60px);
    /* fallback for old browsers */
    -webkit-backdrop-filter: blur(60px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2ASCJPorhwRTFgDLS4.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-images-1.medium.com%2Fmax%2F800%2F0%2ASCJPorhwRTFgDLS4.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There you have it, a Glass card using just CSS. We are still not done yet. We haven’t added a border and shadow to the card. The border and shadow will create a clear distinction between the card and background objects. Let’s add them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.card {
    border-radius: 20px;
    /* other styles */
    background: rgba(39, 39, 39, 0.1);
    backdrop-filter: blur(60px);
     /* fallback for old browsers */
    -webkit-backdrop-filter: blur(60px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.3);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2AAqneFO6uA-iijkiL.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-images-1.medium.com%2Fmax%2F800%2F0%2AAqneFO6uA-iijkiL.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mission accomplished! That’s our Glassmorphism effect using just CSS. You can also add some animation to the background elements to enhance the effect. I used keyframes to move the objects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.circle-1{
        animation: bounce 4s linear infinite;
}
.circle-2{
    animation: bounce 4s linear infinite 1s;
}
.circle-3 {
    animation: bounce 4s linear infinite 2s;
}
@keyframes bounce {


    0% {
        transform: translateY(0px);
    }


    25% {
        transform: translateY(10px);
    }


    50% {
        transform: translateY(0px);
    }


    75% {
        transform: translateY(-10px);
    }


    100% {
        transform: translateY(0px);
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CodePen:&lt;/strong&gt;&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;head&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
    &amp;lt;link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
    &amp;lt;link rel="stylesheet" href="./style.css"&amp;gt;
    &amp;lt;link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet"&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;section&amp;gt;
        &amp;lt;div class="circle-1"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="circle-2"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="circle-3"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div class="card"&amp;gt;
            &amp;lt;div&amp;gt;
                &amp;lt;h1&amp;gt;ANURAG GHARAT&amp;lt;/h1&amp;gt;
                &amp;lt;p&amp;gt;1892 1232 1242 0099&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;
                07/27
            &amp;lt;/p&amp;gt;
                &amp;lt;i class="ri-visa-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can make a lot of variations of the CSS Glassmorphism effect using different backgrounds.&lt;/p&gt;

&lt;p&gt;Here are some variations of our Credit Card project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS Glassmorphism with Stock Background Image:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;


&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;CSS GlassMorphism Card&amp;lt;/title&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
    &amp;lt;link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
    &amp;lt;link rel="stylesheet" href="./style.css"&amp;gt;
            &amp;lt;link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet"&amp;gt;
&amp;lt;/head&amp;gt;


&amp;lt;body&amp;gt;
    &amp;lt;section&amp;gt;
        &amp;lt;div class="card"&amp;gt;
            &amp;lt;div&amp;gt;
                &amp;lt;h1&amp;gt;ANURAG GHARAT&amp;lt;/h1&amp;gt;
                &amp;lt;p&amp;gt;1892 1232 1242 0099&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;
                07/27
            &amp;lt;/p&amp;gt;
            &amp;lt;i class="ri-visa-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
    box-sizing: border-box;
    padding: 0px;
    margin: 0px;
    scroll-behavior: smooth;
    font-family: 'Noto Sans', sans-serif;
}
body {
    width: 100%;
    height: 100%;
    background: #fff;
    font-family: 'Noto Sans', sans-serif;
    background: url('https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
section {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}
.card {
    height: 300px;
    width: 500px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(16px);
    z-index: 10;
 display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.3);
}
.card&amp;gt;i {
    position: absolute;
    top: 10%;
    right: 10%;
    font-size: 2.5rem;
}
.card&amp;gt;div&amp;gt;p {
    letter-spacing: 3px;
    word-spacing: 10px;
    margin-top: 10px;
    font-size: 28px;
    font-family: 'Courier New', Courier, monospace;
}
.card&amp;gt;p {
    position: absolute;
    bottom: 10%;
    fill: #fff;
    letter-spacing: 3px;
    word-spacing: 10px;
    margin-top: 10px;
    font-size: 20px;
}
.card&amp;gt;div&amp;gt;h1 {
    font-weight: lighter;
    font-size: 16px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2AstJgW1h2NJq4F-jv.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-images-1.medium.com%2Fmax%2F800%2F0%2AstJgW1h2NJq4F-jv.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CodePen:&lt;/strong&gt;&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;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;CSS GlassMorphism Card&amp;lt;/title&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
    &amp;lt;link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
    &amp;lt;link rel="stylesheet" href="./style.css"&amp;gt;
            &amp;lt;link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet"&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;section&amp;gt;
        &amp;lt;div class="card"&amp;gt;

            &amp;lt;div&amp;gt;
                &amp;lt;h1&amp;gt;ANURAG GHARAT&amp;lt;/h1&amp;gt;
                &amp;lt;p&amp;gt;1892 1232 1242 0099&amp;lt;/p&amp;gt;

            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;
                07/27
            &amp;lt;/p&amp;gt;
            &amp;lt;i class="ri-visa-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;

&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS Glassmorphism with Simple Gradients:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;


&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;CSS GlassMorphism Card&amp;lt;/title&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
    &amp;lt;link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
    &amp;lt;link rel="stylesheet" href="./style.css"&amp;gt;
            &amp;lt;link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet"&amp;gt;
&amp;lt;/head&amp;gt;


&amp;lt;body&amp;gt;
    &amp;lt;section&amp;gt;
        &amp;lt;div class="card"&amp;gt;


            &amp;lt;div&amp;gt;
                &amp;lt;h1&amp;gt;ANURAG GHARAT&amp;lt;/h1&amp;gt;
                &amp;lt;p&amp;gt;1892 1232 1242 0099&amp;lt;/p&amp;gt;


            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;
                07/27
            &amp;lt;/p&amp;gt;
            &amp;lt;i class="ri-visa-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
    box-sizing: border-box;
    padding: 0px;
    margin: 0px;
    scroll-behavior: smooth;
    font-family: 'Noto Sans', sans-serif;
}
body {
    width: 100%;
    height: 100%;
    background: #fff;
    font-family: 'Noto Sans', sans-serif;
    background: #396afc;
    background: -webkit-linear-gradient(to right, #2948ff, #396afc);
    background: linear-gradient(to right, #2948ff, #396afc);
}
section {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}
.card {
    height: 300px;
    width: 500px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.3);
}
.card&amp;gt;i {
    position: absolute;
    top: 10%;
    right: 10%;
    font-size: 2.5rem;
}
.card&amp;gt;div&amp;gt;p {
    letter-spacing: 3px;
    word-spacing: 10px;
    margin-top: 10px;
    font-size: 28px;
    font-family: 'Courier New', Courier, monospace;
}


.card &amp;gt; p {
    position: absolute;
    bottom: 10%;
    fill: #fff;
    letter-spacing: 3px;
    word-spacing: 10px;
    margin-top: 10px;
    font-size: 20px;
}


.card&amp;gt;div&amp;gt;h1 {
    font-weight: lighter;
    font-size: 16px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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-images-1.medium.com%2Fmax%2F800%2F0%2ARfaRP-pt04Tn5JPY.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-images-1.medium.com%2Fmax%2F800%2F0%2ARfaRP-pt04Tn5JPY.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CodePen:&lt;/strong&gt;&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;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;CSS GlassMorphism Card&amp;lt;/title&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
    &amp;lt;link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
    &amp;lt;link rel="stylesheet" href="./style.css"&amp;gt;
            &amp;lt;link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet"&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;section&amp;gt;
        &amp;lt;div class="card"&amp;gt;

            &amp;lt;div&amp;gt;
                &amp;lt;h1&amp;gt;ANURAG GHARAT&amp;lt;/h1&amp;gt;
                &amp;lt;p&amp;gt;1892 1232 1242 0099&amp;lt;/p&amp;gt;

            &amp;lt;/div&amp;gt;
            &amp;lt;p&amp;gt;
                07/27
            &amp;lt;/p&amp;gt;
            &amp;lt;i class="ri-visa-line"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;

&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Tips to achieve the best CSS Glassmorphism
&lt;/h3&gt;

&lt;p&gt;In the previous section; we discussed how to create Glassmorphism using CSS. Now let’s look at some tips that will help you effectively implement Glassmorphism in your designs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use vivid backgrounds that blend nicely with the glass effect. You can go with &lt;a href="https://www.lambdatest.com/blog/complete-guide-to-cross-browser-compatible-css-gradients/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;CSS Gradients&lt;/a&gt;, Mesh gradients, Geometrical Designs, 3D objects, and stock images.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add some user animations and interactions, like hover effects, to make the UI playful.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To add depth to your design, you can include floating assets like circles or objects of any shape.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t forget the border and shadow for the card.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t apply this effect to user Interaction elements like buttons, toggles, and inputs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t overuse Glassmorphism.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Prepare to ace your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/nunit-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=june_27&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;em&gt;NUnit interviews questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with our thorough set of solutions that will enable you to prove your command of the NUnit testing framework.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrapping up
&lt;/h3&gt;

&lt;p&gt;Glassmorphism design makes your UI more modern and minimalist. I feel this new UI style is here to stay, and many products will incorporate it in their design style.&lt;/p&gt;

&lt;p&gt;That’s it. I hope you found this guide on CSS Glassmorphism. In this guide, we saw Glassmorphism and understood its history and main characteristics. We later created a Glassmorphism design of a Credit Card using CSS and saw some variations.&lt;/p&gt;

&lt;p&gt;If you love the new CSS Glassmorphism trend, try creating some cool projects with it and share them in the comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Happy Coding!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>glassmorphism</category>
      <category>guide</category>
      <category>automationtesting</category>
    </item>
    <item>
      <title>CSS Website Layout For CSS Website Layout For Dual Screen And Foldable Devices</title>
      <dc:creator>Anuraggharat651</dc:creator>
      <pubDate>Mon, 26 Jun 2023 06:34:30 +0000</pubDate>
      <link>https://dev.to/anuraggharat651/css-website-layout-for-css-website-layout-for-dual-screen-and-foldable-devices-13gc</link>
      <guid>https://dev.to/anuraggharat651/css-website-layout-for-css-website-layout-for-dual-screen-and-foldable-devices-13gc</guid>
      <description>&lt;p&gt;With more and more Dual Screen phones being introduced in the market, it is fair to say that we are entering an “Era of Dual Screen Devices.” And why not? Dual Screen phones are so much better for productivity and media consumption.&lt;/p&gt;

&lt;p&gt;Dual Screen (or Foldable) phones come with all form factors to suit every user’s needs. In Dual Screen devices, you can have a phone that can be folded into a size that fits in your palm, while on the other side, you can have a phone which unfolds into the size of a regular tablet.&lt;/p&gt;

&lt;p&gt;According to a report in 2021, Dual Screen phones have a 0.5 percent share of the total smartphone market. This is expected to grow by 69.9 percent CAGR by 2025. So it’s fair to say that this decade we will see a lot of foldable and multiscreen phones in the market, and in no time, they will be mainstream.&lt;/p&gt;

&lt;p&gt;But with new form factors comes a new screen resolution and compatibility issues for the front-end developers. So now, with the already existing devices in the market, a front-end developer also has to make his website responsive on Dual Screen Devices and Foldables.&lt;/p&gt;

&lt;p&gt;Hence looking at this growing adoption of multi-screen or Foldable devices, in 2020 &lt;strong&gt;Microsoft&lt;/strong&gt; announced new Web APIs specially designed for Dual Screen phones. These new Web APIs include CSS Screen Spanning Media Feature and JavaScript Visual Viewport Segment API, which help developers to enhance their website experience on Dual Screen phones.&lt;/p&gt;

&lt;p&gt;In this blog on CSS Website Layouts, we will dive deep into these newly announced Dual Screen Web APIs and learn how to use them to make your website responsive. In the end, we will take an example of a Blog page and make it responsive for Dual Screen and Foldable phones. If you are new to Responsive web design, check the guide on &lt;a href="https://www.lambdatest.com/learning-hub/responsive-design?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;Responsive Design&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;In this Selenium with Java tutorial, you will learn everything you need to know to kick start your journey in Selenium&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/selenium-with-java/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;automation testing Java&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Styling on a Foldable or Dual Screen device
&lt;/h3&gt;

&lt;p&gt;You can categorize Foldables or Dual Screen devices into two categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Two separate screens joined by a mechanical hinge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One Single Screen where the actual screen folds from the middle.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8NOK4hM8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Af-LimLczEwMCotbs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8NOK4hM8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Af-LimLczEwMCotbs.png" alt="image" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Foldable or Dual Screen device can have 4 Possible orientations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Single Screen Portrait mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Single Screen Landscape mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dual Screen Portrait Mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dual Screen Landscape Mode.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uY_v8Q5I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Ayy50MQT6GuaUCWGM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uY_v8Q5I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Ayy50MQT6GuaUCWGM.png" alt="image" width="800" height="637"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So as you can see, you must consider many viewport scenarios while constructing your queries. The second issue with the Dual Screen display is the position of the hinge.&lt;/p&gt;

&lt;p&gt;Dual Screen phones like Microsoft Duo 2 have a mechanical hinge that divides the display into two logical screens. The position of the hinge is exactly in the middle, so any centered content gets hidden behind the hinge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;React is a javascript-based mobile app development framework. Learn how to use Appium and Jest for&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/test-react-native-apps-on-ios-and-android/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;React Native Automation testing tools&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;for apps on iOS and Android.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5aGg8b3L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AqkzPRHGU5n92d2Rl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5aGg8b3L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AqkzPRHGU5n92d2Rl.jpg" alt="image" width="450" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s consider our favorite YouTube website and see how it looks on a Dual Screen device.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KH-bqt1R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AGRkOU2k2aCzM0Hs9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KH-bqt1R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AGRkOU2k2aCzM0Hs9.png" alt="image" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the screen gets divided at the center; hence any object present behind the hinge is lost. This issue gets worse in the case of modals or buttons that are placed exactly at the center.&lt;/p&gt;

&lt;p&gt;So we need to &lt;a href="https://www.lambdatest.com/blog/20-elements-of-modern-web-design/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;design the website&lt;/a&gt; in such a way that it breaks the content into two separate sections and avoids showing any content at the center, something similar to a book. This design is great for improving User Experience and Productivity.&lt;/p&gt;

&lt;p&gt;By breaking the content into separate sections, we can fit in more information than a usual Single Screen device.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FnUQck5I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A1U0orRyJagEuL5Hz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FnUQck5I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A1U0orRyJagEuL5Hz.png" alt="image" width="800" height="768"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we move onto the crux of the topic, let’s talk about browser availability and how to test the output on a Dual Screen device in your Browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;In this Selenium with Java tutorial, you will learn everything you need to know to kick start your journey in Selenium&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/selenium-with-java/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;automation testing using Java&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Browser Support and Availability
&lt;/h3&gt;

&lt;p&gt;Currently, the Dual Screen APIs are available in all the latest versions of all &lt;strong&gt;Chromium&lt;/strong&gt; browsers like &lt;strong&gt;Microsoft Edge&lt;/strong&gt; and &lt;strong&gt;Google Chrome&lt;/strong&gt; but are still in the &lt;strong&gt;experimental phase&lt;/strong&gt;. You need to enable these features in your browser settings to use them.&lt;/p&gt;

&lt;p&gt;To enable these features, go to &lt;em&gt;Chrome://flags&lt;/em&gt; if you are on chrome or &lt;em&gt;Edge://flags&lt;/em&gt; if you are using Edge. In the search bar, type &lt;strong&gt;Experimental Web Platform&lt;/strong&gt; features and change the disabled flag to enable and relaunch the browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9uT6jcg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AnupQAg0jJngPuR1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9uT6jcg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AnupQAg0jJngPuR1t.png" alt="image" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can test the queries using the &lt;strong&gt;developer tools&lt;/strong&gt; in Chrome or Edge, as we do for other devices.&lt;/p&gt;

&lt;p&gt;Open your website in Google Chrome and press &lt;em&gt;CTRL+SHIFT+I&lt;/em&gt; to open the Developer tools panel. You can choose a Dual Screen Device in the output panel to show your output. If you can’t find a Dual Screen Device, click on the edit option on the bottom and add Microsoft Surface Duo as a new device.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J2JPlJlf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ACir_TV3ndK4HFpBS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J2JPlJlf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ACir_TV3ndK4HFpBS.png" alt="image" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Here’s 295+&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/selenium-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;Selenium Interview Questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with Answers that will help you boost your confidence in an Interview.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Dual Screen Web APIs
&lt;/h3&gt;

&lt;p&gt;Looking at the rise of Foldables and Multiscreen Devices in the market, &lt;strong&gt;Microsoft&lt;/strong&gt; announced two new Web APIs in &lt;strong&gt;2020&lt;/strong&gt;. These APIs integrate with the existing &lt;a href="https://www.lambdatest.com/blog/css-media-queries-for-responsive-design/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Media Queries&lt;/a&gt; and JavaScript Visual Viewport API so that developers can work more towards utilizing the Dual Screen space for a better user experience than learning an entirely new feature from scratch. These Dual Screen Web APIs include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;CSS Screen Spanning Media Feature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JavaScript Segments Enumeration API.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the next section of this blog on CSS Website Layouts, we will discuss the CSS Screen Spanning Media feature.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS Screen Spanning Media Feature
&lt;/h3&gt;

&lt;p&gt;CSS Screen Spanning Media feature consists of specifically designed media queries to help front-end developers optimize the content for Dual Screen or Foldable devices. This new Media feature is an addition to the existing CSS Media queries we use to add responsiveness to our website.&lt;/p&gt;

&lt;p&gt;If you don’t know what a Media Query in CSS is,&lt;/p&gt;

&lt;p&gt;Media Query is a CSS rule used to apply a set of CSS properties based on some conditions. CSS Media queries form an integral part of Responsive Web Design.&lt;/p&gt;

&lt;p&gt;The CSS screen-spanning media query detects whether your website is opened on a multi-screen device and applies styles based on that. This Query has two variations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;horizontal-viewport-segments&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;vertical-viewport-segments&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Horizontal Segments Media Query
&lt;/h3&gt;

&lt;p&gt;This CSS screen-spanning query is used to check the number of &lt;strong&gt;Horizontal&lt;/strong&gt; screens available on the Output device. This query is triggered when the Foldable device is held in &lt;strong&gt;Dual Screen Portrait Mode&lt;/strong&gt; (Like a Book) where the fold or hinge is &lt;strong&gt;vertically&lt;/strong&gt; in the middle.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XNBr45oJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ALJw26dtVVr7NmMGN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XNBr45oJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ALJw26dtVVr7NmMGN.png" alt="image" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; @media (horizontal-viewport-segments: count) {
    /* CSS Styles for this posture  */
 }


 /*Here count is the number of screens in this mode */
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s design a media query where the background color of the body will change to red if the Device is opened in Dual Screen Portrait mode and has 2 screens horizontally beside each other.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS Media Query:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media (horizontal-viewport-segments: 2) {
    body {
        background-color: red;
    }
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Vertical Segments Media Query
&lt;/h3&gt;

&lt;p&gt;Vertical Segments query is used to check the number of &lt;strong&gt;Vertical&lt;/strong&gt; screens available on the output device. This query is triggered when the Foldable device is held in &lt;strong&gt;Dual Screen Landscape Mode&lt;/strong&gt; (Like a Vertical Book) where the fold or hinge is present &lt;strong&gt;horizontally&lt;/strong&gt; in the middle.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cFmKPotf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AbzZdDp_NtsJyFfgq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cFmKPotf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AbzZdDp_NtsJyFfgq.png" alt="image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; @media (vertical-viewport-segments: count) {
    /* CSS Styles for this posture  */
  }


/* Here count is the number of screens in this mode */
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s design a media query where the background color of the body will change to red if the Device is opened in Dual Screen Landscape mode and has 2 screens vertically above each other.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; @media (vertical-viewport-segments: 2) {
    body {
        background-color: red;
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Get ready to ace your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/Junit-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;JUnit interviews question&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;in 2023 with our comprehensive list of 90 questions and answers that will help you sharpen your testing skills.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Chaining Multiple Queries
&lt;/h3&gt;

&lt;p&gt;You can also chain CSS Screen Spanning media queries with additional conditions like the width or height of the viewports.&lt;/p&gt;

&lt;p&gt;Here we are writing a query where the styles will be applied if the vertical viewport segments are 2 and the minimum width of the segment is 400px.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; @media (vertical-viewport-segments: 2) and (min-width: 400px) {
    /* Styles to be applied for this specific condition */
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  CSS Environment Variables
&lt;/h3&gt;

&lt;p&gt;Along with Web APIs, developers can also utilize 6 newly introduced CSS Environment variables to calculate the Geometry of the display region on the screens. These variables can be used to&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Get the display area of the screen&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Calculate the geometry of the hinge (if present)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Align the content on the screen&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Get segment Width */
env(viewport-segment-width &amp;lt;x&amp;gt; &amp;lt;y&amp;gt;);


/* Get segment Height */
env(viewport-segment-height &amp;lt;x&amp;gt; &amp;lt;y&amp;gt;);


/* Get position of top */
env(viewport-segment-top &amp;lt;x&amp;gt; &amp;lt;y&amp;gt;);


/* Get position of left */
env(viewport-segment-left &amp;lt;x&amp;gt; &amp;lt;y&amp;gt;);


/* Get position of bottom */
env(viewport-segment-bottom &amp;lt;x&amp;gt; &amp;lt;y&amp;gt;);


/* Get position of right */
env(viewport-segment-right &amp;lt;x&amp;gt; &amp;lt;y&amp;gt;);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The x and y position represent the coordinates of the 2D grid with the center(0,0) in the top-left corner. Using these positions, the screen can be divided into two separate regions denoted by 0 and 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UYQZLOH1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABBvZAZixXec4DFxC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UYQZLOH1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABBvZAZixXec4DFxC.png" alt="image" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Represents the width of the left screen in Dual Portrait mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  env(viewport-segment-width 0 0);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Represents the width of the right screen in Dual Portrait mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; env(viewport-segment-width 1 0)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Represents the width of the top screen in Dual Landscape mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  env(viewport-segment-width 0 0);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Represents the width of the bottom screen in Dual Landscape mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  env(viewport-segment-width 0 1);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, we can get the height and the corner positions using these variables. Let’s look at how we can calculate the hinge width when the device is used in Dual Screen Portrait mode.&lt;/p&gt;

&lt;p&gt;To get the width of the hinge, we must first get the position of the left-top and right-top corners of the hinge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vaxLeDKV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5NxB73XJ4AOSJEgS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vaxLeDKV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5NxB73XJ4AOSJEgS.png" alt="image" width="800" height="410"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;env(viewport-segment-right 0 0);
/* Top left corner of hinge*/


env(viewport-segment-left 1 0);
/* Top right corner of hinge*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Subtracting the left corner of the right screen from the right corner of the left screen will get you the width of the hinge.&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 hinge=calc(env(viewport-segment-left 1 0) - 
               env(viewport-segment-right 0 0))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, you can get the height of the hinge by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;height of hinge = calc(env(viewport-segment-top 0 1) -     
                       env(viewport-segment-bottom 0 0))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can pass the height as a value to a CSS property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div{
    margin-top: calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;This exhaustive list of&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/testng-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;TestNG interview questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;will aid you in strengthening your position as a candidate for the TestNG interview.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  JavaScript Visual Viewport Segments API
&lt;/h3&gt;

&lt;p&gt;In cases where the developer is unable to use CSS to detect a Foldable or Dual Screen Device, he can make use of JavaScript &lt;em&gt;visualViewport.segments&lt;/em&gt; API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cm58jVQc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AtzRXUw_FPTVhOFHe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cm58jVQc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AtzRXUw_FPTVhOFHe.png" alt="image" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source&lt;/p&gt;

&lt;p&gt;In the initial draft, a completely new JavaScript API called JavaScript Windows Segment Enumeration API was proposed. But after getting feedback from the developer community, they decided to implement it in the existing &lt;strong&gt;Visual Viewport API.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;VisualViewport API&lt;/strong&gt; represents the visual viewport for the screen. The API has properties like&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;visualViewport.width&lt;/em&gt; — returns the viewport width&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;visualViewport.height&lt;/em&gt; — returns the viewport height&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;visualViewport.scale&lt;/em&gt; — returns the scaling factor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;visualViewport.offsetLeft&lt;/em&gt; — returns the offset of the left edge&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;visualViewport.offsetTop&lt;/em&gt; — returns the offset of the top edge&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;visualViewport.pageLeft&lt;/em&gt; — returns the x coordinate of the top edge&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;visualViewport.pageTop&lt;/em&gt; — returns the y coordinate of the top edge&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to the existing properties, a new property named visualViewport.segments was introduced. This property provides the count of segments available on the device where the browser is being used.&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;


&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Visual Viewport API DEMO.&amp;lt;/title&amp;gt;


&amp;lt;/head&amp;gt;


&amp;lt;body&amp;gt;
    &amp;lt;script&amp;gt;


    let screens = window.visualViewport.segments;


    console.log(screens);

    &amp;lt;/script&amp;gt;
    &amp;lt;h1&amp;gt;Check Console&amp;lt;/h1&amp;gt;


&amp;lt;/body&amp;gt;


&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t-QnrmPw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Al9zD8jAkN1AknAxt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t-QnrmPw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Al9zD8jAkN1AknAxt.png" alt="image" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;window.visualViewport.segments&lt;/em&gt; property returns an array containing the DOMRects across which the browser is spanned. Each &lt;strong&gt;DOMRect&lt;/strong&gt; object contains the height and width of each screen along with its x, y, left, right, top, and bottom coordinates. Using these coordinates, you can easily calculate the width and height of the hinge. The query will return a &lt;strong&gt;null&lt;/strong&gt; value if the number of displays is 1.&lt;/p&gt;

&lt;p&gt;So in the case of a Microsoft Surface Duo, which is open in Dual Screen Portrait mode, the value returned from &lt;em&gt;window.visualViewport.segments&lt;/em&gt; will be an array with 2 values representing the screens. The first object represents the left/top screen, and the second object represents the right/bottom screen. For a single viewport (Desktop, Mobile, Laptop), the value of segments will be null.&lt;/p&gt;

&lt;p&gt;The value returned is an &lt;strong&gt;immutable snapshot&lt;/strong&gt; of the device’s state when the object property was queried. So in case the device is rotated, or the state of the displays is changed, the value will no longer be valid. In such cases, we can add an event listener for ‘resize’ and pass a function that will calculate the number of segments available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;


&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Dual Screen APIs.&amp;lt;/title&amp;gt;


&amp;lt;/head&amp;gt;


&amp;lt;body&amp;gt;


    &amp;lt;h1&amp;gt;JavaScript's Viewport segment API for Dual Screen devices&amp;lt;/h1&amp;gt;


&amp;lt;/body&amp;gt;


&amp;lt;/html&amp;gt;
    &amp;lt;script&amp;gt;


        let screens;


        // runs every time the user resizes the window
        window.addEventListener('resize', () =&amp;gt; {
            screens = window.visualViewport.segments;
            //to check if screens array is null(If null it means its a single screen device)
            if (screens) {
                console.log(screens.length);
            }
            else {
                console.log("Opened in Single Screen mode")
            }
        });


    &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GV46ULz5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AWNAj20ZLfIPIU_uU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GV46ULz5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AWNAj20ZLfIPIU_uU.png" alt="image" width="800" height="429"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let screens;

        // runs everytime the user resizes the window
        window.addEventListener('resize', () =&amp;gt; {
            screens = window.visualViewport.segments;
            //to check if screens array is null(If null it means its a single screen device)
            if (screens) {
                console.log(screens.length);
            }
            else {
                console.log("Opened in Single Screen mode")
            }
        });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;This questionnaire of&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/jasmine-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;Jasmine Interview questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;will aid you in giving good insight about Jasmine and how to crack the interview.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Demonstration: Building a simple Blog page using CSS Website Layouts
&lt;/h3&gt;

&lt;p&gt;In this section of this blog on CSS Website Layouts, we will demonstrate how to build a simple blog page using CSS Website Layouts.&lt;/p&gt;

&lt;p&gt;Now that we know about Dual Screen Web APIs let’s test our knowledge by building a small project. We will build a simple Blog page that we will try to make responsive for Dual Screens. Let’s take a look at the design first.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AL-njNBI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Alnty12qnTksrzJcB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AL-njNBI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Alnty12qnTksrzJcB.png" alt="image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s start with the HTML first. We have a heading, an image, some dummy content, and 3 image cards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;body&amp;gt;
&amp;lt;section&amp;gt;
    &amp;lt;main&amp;gt;
        &amp;lt;h1 class="heading"&amp;gt;This is my first blog about my trip to the mountains&amp;lt;/h1&amp;gt;
         &amp;lt;img
                src="https://images.pexels.com/photos/147411/italy-mountains-dawn-daybreak-147411.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600" /&amp;gt;
        &amp;lt;/main&amp;gt;


    &amp;lt;article&amp;gt;
        &amp;lt;p class="itallic"&amp;gt;
            "Some Dummy Content Here"
        &amp;lt;/p&amp;gt;
        &amp;lt;p class="content"&amp;gt;
            &amp;lt;!--Some Dummy Content here--&amp;gt;
        &amp;lt;/p&amp;gt;
        &amp;lt;p class="content"&amp;gt;
            &amp;lt;!--Some Dummy Content here--&amp;gt;
        &amp;lt;/p&amp;gt;
        &amp;lt;p class="content"&amp;gt;
            &amp;lt;!--Some Dummy Content here--&amp;gt;
        &amp;lt;/p&amp;gt;
        &amp;lt;h2&amp;gt;Recent Posts&amp;lt;/h2&amp;gt;
        &amp;lt;div class="row"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/1021808/pexels-photo-1021808.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
  pre                      alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the mountains&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/457878/pexels-photo-457878.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the beach&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/220201/pexels-photo-220201.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the space&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;


        &amp;lt;/div&amp;gt;
    &amp;lt;/article&amp;gt;
&amp;lt;/section&amp;gt;


&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For CSS, I am using &lt;a href="https://www.lambdatest.com/blog/css-flexbox-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;Flexbox&lt;/a&gt; to align the content. If you are more comfortable with Grid, you can use &lt;a href="https://www.lambdatest.com/blog/css-grid/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Grid&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: 'DM Sans', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
}
section {
    max-width: 1200px;
    padding: 3rem 0;
}
img {
    width: 100%;
    border-radius: 10px;
}
h1 {
    font-size: 4rem;
}
.heading,
.itallic,
.content,
h2 {
    margin: 2rem 0;
}
.itallic {
    font-style: italic;
    color: gray;
}
.row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
}
.card {
    width: 30%;
}
.card p {
    font-size: 1.2rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what we have finished until now. Clean and simple design.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tAmgD0pW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A7hKrzGHdAH-5to_T.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tAmgD0pW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A7hKrzGHdAH-5to_T.png" alt="image" width="800" height="787"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Prepare to ace your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/nunit-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;NUnit interviews questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with our thorough set of solutions that will enable you to prove your command of the NUnit testing framework.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The basic layout of the blog is done. Time to add responsiveness to our blog. Let’s start with adding media queries for mobile and tablet devices.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* media queries for mobile devices */
@media screen and (max-width: 480px) {
    section {
        padding: 1rem;
    }


    h1 {
        font-size: 2rem;
    }


    .row {
        display: flex;
        flex-direction: column;
    }


    .card {
        width: 100%;
        margin: 1rem 0;
    }
}


/* media queries for tablet and small laptops*/
@media screen and (min-width:480px) and (max-width: 1200px) {
    section {
        padding: 2rem;
    }
    h1 {
        font-size: 3rem;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CgiRRfu5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AhO_hQj8MifOqEtxA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CgiRRfu5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AhO_hQj8MifOqEtxA.png" alt="image" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am using the &lt;a href="https://www.lambdatest.com/lt-browser?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;LT Browser&lt;/a&gt; to check the output of CSS Website Layouts on various device viewports. As you can see, I can test the responsiveness on a laptop and a mobile viewports side by side.&lt;/p&gt;

&lt;p&gt;LT Browser is a &lt;a href="https://www.lambdatest.com/mobile-friendly-test?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;mobile-friendly test&lt;/a&gt; tool that enables you to conduct &lt;a href="https://www.lambdatest.com/learning-hub/responsive-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive testing&lt;/a&gt; of your CSS Website Layouts and guarantee your layout’s adaptability across different device viewports. Using LT Browser, you can assess your website’s responsiveness on more than 50 pre-configured device viewports, comprising smartphones, tablets, laptops, and desktops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Navigate your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/laravel-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;Laravel interview questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with ease! Our guide covers over 190 questions to help you land your ideal tech job.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now let’s move on to the objective of this tutorial on CSS Website Layouts, which is Dual Screen Responsiveness. But before that, let’s see how our Blog page looks without adding Media queries for Dual Screen display in the next section of this tutorial on CSS Website Layouts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--roohtYRh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AgSHKrhHj1CeuFEe-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--roohtYRh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AgSHKrhHj1CeuFEe-.png" alt="image" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the content is getting blocked by the hinge. Here’s a design of how I want the website to look on Dual Screen Display.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wHDm9QrJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADgG3ErDssb7HOHL1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wHDm9QrJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADgG3ErDssb7HOHL1.png" alt="image" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tJgcyWMh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A9NaBPitvqJIE_v4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tJgcyWMh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A9NaBPitvqJIE_v4t.png" alt="image" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are starting with Dual Screen Portrait mode and then moving to Dual Screen Landscape mode.&lt;/p&gt;

&lt;p&gt;First, we need to change the flex-direction of the blog content to row format so that we can get a two-column layout with an image and heading on the left and content on the right.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media (horizontal-viewport-segments: 2) {
    section {
        display: flex;
        padding: 0;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--48endGxw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVy7unQdB-noADOVk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--48endGxw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVy7unQdB-noADOVk.png" alt="image" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the content is flexed in a row but still not as we want it. Let’s set the width of the element that contains an image and heading equally to the width of the left screen. We will use env variables to get the width of the left screen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main {
    min-width: env(viewport-segment-width 0 0);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will do the same with text content. We will set the minimum content width equal to the screen’s width on the right.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;article {
    min-width: env(viewport-segment-width 1 0);


}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b5uE_ZM3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AbQyi9POiz6j44-NA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b5uE_ZM3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AbQyi9POiz6j44-NA.png" alt="image" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result looks far better than we started with in this blog on CSS Website Layouts, but still, the design needs improvement. If you look closely, the left part of the content is blocked by the hinge. It’s behind the hinge; hence it’s cropped from the screen.&lt;/p&gt;

&lt;p&gt;We can solve that by adding a margin-left to the article tag. This margin value should be equal to the width of the hinge.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;article {
    margin-left: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0));
    width: env(viewport-segment-width 0 1);
    padding: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bGcT8vyw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AimpzHRIR9GJfhBD3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bGcT8vyw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AimpzHRIR9GJfhBD3.png" alt="image" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There you go, we have made our Blog page responsive for Dual Screen devices. You can check the code for the Simple Blog here on my CodePen. Now let’s move on to the second mode — Dual Screen Landscape mode. Here we need to do some alignment to display the content properly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fCxL3f88--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AvfX-X7aXNpK-lY6O.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fCxL3f88--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AvfX-X7aXNpK-lY6O.png" alt="image" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Media queries for double portrait mode: ( Dual Screen Book mode) */
@media (vertical-viewport-segments: 2) {
    section {
        padding: 0;
    }  
    main {
        width: env(viewport-segment-width 0 0);
        text-align: center;
        min-height: env(viewport-segment-height 0 0);
        padding: 1rem;
    }
    h1 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    main&amp;gt;img{
        width: 80%;
    }
    article {
        width: env(viewport-segment-width 0 1);
        padding: 1rem;
        margin-top: calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0));
    }
    .row {
        display: flex;
    }
    .card {
        width: 30%;
    }
    .card img{
        width: 100%;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this section of this blog on CSS Website Layouts, the top is spanned across the entire top screen and added a margin-top for the content present on the bottom screen so that the text does not get hidden behind the hinge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jSWtMOCk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ApKTR1OjRNB-EH24S.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jSWtMOCk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ApKTR1OjRNB-EH24S.png" alt="image" width="800" height="429"&gt;&lt;/a&gt;&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;link
        href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&amp;amp;family=Poppins:wght@100;200;300;400;500;600;700;800;900&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
&amp;lt;body&amp;gt;

    &amp;lt;section&amp;gt;
        &amp;lt;main&amp;gt;
            &amp;lt;h1 class="heading"&amp;gt;This is my first blog about my trip to the mountains&amp;lt;/h1&amp;gt;
            &amp;lt;img
                src="https://images.pexels.com/photos/147411/italy-mountains-dawn-daybreak-147411.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600" /&amp;gt;
        &amp;lt;/main&amp;gt;
        &amp;lt;article&amp;gt;
            &amp;lt;p class="itallic"&amp;gt;"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque expedita asperiores laudantium natus
                enim, placeat iure! Iure sapiente fugiat iusto. Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio
                maxime accusamus eius repellendus dolor modi esse temporibus, amet voluptas itaque!"&amp;lt;/p&amp;gt;
            &amp;lt;p class="content"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Error sequi quibusdam, esse illo distinctio quas culpa
                aspernatur nostrum, et veritatis neque sapiente! Ducimus tempore maxime obcaecati modi, deleniti commodi possimus
                cupiditate, veniam architecto voluptatibus ipsa cum tempora nobis dolorem explicabo ipsum aliquid, non molestias
                veritatis quam consectetur quia fugit? Laborum, laboriosam voluptatem. Sit corporis quod cumque cupiditate
                dignissimos, aliquam nulla voluptas ea autem debitis dolorum sunt, ratione doloremque velit porro accusantium
                consequuntur et? Enim dolorum iure officia, animi nam rem quas distinctio at aliquam ipsum quos deleniti placeat.
                Quas nisi cumque eligendi sapiente, dolorum consectetur provident quos itaque magni porro.&amp;lt;/p&amp;gt;
            &amp;lt;p class="content"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt dicta vitae voluptates, saepe accusamus labore nisi
                qui repellat asperiores quaerat, unde sint quae? Eos sed voluptatibus consectetur ducimus, quaerat illo similique
                nemo iure perferendis corrupti quidem quasi explicabo architecto id debitis recusandae eum ab molestias assumenda
                animi nesciunt vero ut!
            &amp;lt;/p&amp;gt;
            &amp;lt;p class="content"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Natus, eius? Facilis pariatur, fugit doloremque eveniet
                temporibus quisquam nesciunt architecto accusantium aut neque magnam nemo excepturi. Temporibus, a rerum quae
                expedita sapiente est voluptates, laborum qui, explicabo molestiae corrupti atque fugit quam laudantium cupiditate
                nihil minima unde non dolorum esse numquam culpa. Quas libero optio doloremque debitis adipisci vero mollitia.
                Tenetur autem quasi consequatur dicta, aliquid non?
            &amp;lt;/p&amp;gt;
            &amp;lt;h2&amp;gt;Recent Posts&amp;lt;/h2&amp;gt;
            &amp;lt;div class="row"&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/1021808/pexels-photo-1021808.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the mountains&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/457878/pexels-photo-457878.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the beach&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/220201/pexels-photo-220201.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the space&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;

            &amp;lt;/div&amp;gt;
        &amp;lt;/article&amp;gt;
    &amp;lt;/section&amp;gt;

&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Ace your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/unit-testing-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;Unit testing interviews&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with our comprehensive interview questions and solutions for unit testing, covering topics from syntax to advanced techniques.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now in most cases, what we did would be enough. But I want to go one step up and think about the UX. In this section of this blog on CSS Website Layouts, we haven’t fully utilized the multi-screen setup.&lt;/p&gt;

&lt;p&gt;Both screens are scrolled together in Dual Screen Portrait mode when we scroll. Hence the image is lost and the left screen is blank. It would be better if we stick the image and heading on one screen and allow the user to scroll only the textual region (right screen).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In my opinion, this looks better than the previous ones. I could keep the image in focus fixed on one side of the display while allowing the user to read the content from another side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS (for the above output):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: 'DM Sans', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
}


section {
    max-width: 1200px;
    padding: 3rem 0;
}


img {
    width: 100%;
    border-radius: 10px;
}


h1 {
    font-size: 4rem;
}


.heading,
.itallic,
.content,
h2 {
    margin: 2rem 0;
}


.itallic {
    font-style: italic;
    color: gray;
}


.row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
}


.card {
    width: 30%;
}


.card p {
    font-size: 1.2rem;
}


/* media queries for mobile devices */
@media screen and (max-width: 480px) {
    section {
        padding: 1rem;
    }


    h1 {
        font-size: 2rem;
    }


    .row {
        display: flex;
        flex-direction: column;
    }


    .card {
        width: 100%;
        margin: 1rem 0;
    }
}


/* media queries for tablets and small laptops*/
@media screen and (min-width:480px) and (max-width: 1200px) {
    section {
        padding: 2rem;
    }


    h1 {
        font-size: 3rem;
    }
}
/* Media queries for double portrait mode: ( Dual Screen Book mode) */
@media (horizontal-viewport-segments: 2) {
    section {
        display: flex;
        padding: 0;
        position: relative;
    }


    main {
        width: env(viewport-segment-width 0 0);
        padding: 1rem;
        height: env(viewport-segment-height 0 0);
        position: fixed;
    }


    article {
        margin-left: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0) + env(viewport-segment-width 0 0));
        width: env(viewport-segment-width 0 1);
        padding: 1rem;
        overflow: scroll;


    }


    .row {
        display: flex;
        flex-direction: column;
    }


    .card {
        width: 100%;
        margin: 1rem 0;
    }
}


/* Media queries for double landscape mode: ( Dual Screen laptop mode) */
@media (vertical-viewport-segments: 2) {
    section {
        padding: 0;
        position: relative;
    }


    main {
        width: env(viewport-segment-width 0 0);
        text-align: center;
        height: env(viewport-segment-height 0 0);
        padding: 1rem;
        position: fixed;
        background-color: #fff;
    }


    h1 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }


    main&amp;gt;img {
        width: 80%;
    }


    article {
        width: env(viewport-segment-width 0 1);
        padding: 1rem;
        margin-top: calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0) + env(viewport-segment-height 0 0));
    }


    .row {
        display: flex;
    }


    .card {
        width: 30%;
    }


    .card img {
        width: 100%;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Sample Blog.&amp;lt;/title&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.googleapis.com"&amp;gt;
    &amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
    &amp;lt;link
        href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&amp;amp;family=Poppins:wght@100;200;300;400;500;600;700;800;900&amp;amp;display=swap"
        rel="stylesheet"&amp;gt;
        &amp;lt;link rel="stylesheet" href="./style.css"&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

    &amp;lt;section&amp;gt;
        &amp;lt;main&amp;gt;
            &amp;lt;h1 class="heading"&amp;gt;This is my first blog about my trip to the mountains&amp;lt;/h1&amp;gt;
            &amp;lt;img
                src="https://images.pexels.com/photos/147411/italy-mountains-dawn-daybreak-147411.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600" /&amp;gt;
        &amp;lt;/main&amp;gt;
        &amp;lt;article&amp;gt;
            &amp;lt;p class="itallic"&amp;gt;"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque expedita asperiores laudantium natus
                enim, placeat iure! Iure sapiente fugiat iusto. Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio
                maxime accusamus eius repellendus dolor modi esse temporibus, amet voluptas itaque!"&amp;lt;/p&amp;gt;
            &amp;lt;p class="content"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Error sequi quibusdam, esse illo distinctio quas culpa
                aspernatur nostrum, et veritatis neque sapiente! Ducimus tempore maxime obcaecati modi, deleniti commodi possimus
                cupiditate, veniam architecto voluptatibus ipsa cum tempora nobis dolorem explicabo ipsum aliquid, non molestias
                veritatis quam consectetur quia fugit? Laborum, laboriosam voluptatem. Sit corporis quod cumque cupiditate
                dignissimos, aliquam nulla voluptas ea autem debitis dolorum sunt, ratione doloremque velit porro accusantium
                consequuntur et? Enim dolorum iure officia, animi nam rem quas distinctio at aliquam ipsum quos deleniti placeat.
                Quas nisi cumque eligendi sapiente, dolorum consectetur provident quos itaque magni porro.&amp;lt;/p&amp;gt;
            &amp;lt;p class="content"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Sunt dicta vitae voluptates, saepe accusamus labore nisi
                qui repellat asperiores quaerat, unde sint quae? Eos sed voluptatibus consectetur ducimus, quaerat illo similique
                nemo iure perferendis corrupti quidem quasi explicabo architecto id debitis recusandae eum ab molestias assumenda
                animi nesciunt vero ut!
            &amp;lt;/p&amp;gt;
            &amp;lt;p class="content"&amp;gt;
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Natus, eius? Facilis pariatur, fugit doloremque eveniet
                temporibus quisquam nesciunt architecto accusantium aut neque magnam nemo excepturi. Temporibus, a rerum quae
                expedita sapiente est voluptates, laborum qui, explicabo molestiae corrupti atque fugit quam laudantium cupiditate
                nihil minima unde non dolorum esse numquam culpa. Quas libero optio doloremque debitis adipisci vero mollitia.
                Tenetur autem quasi consequatur dicta, aliquid non?
            &amp;lt;/p&amp;gt;
            &amp;lt;h2&amp;gt;Recent Posts&amp;lt;/h2&amp;gt;
            &amp;lt;div class="row"&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/1021808/pexels-photo-1021808.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the mountains&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/457878/pexels-photo-457878.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the beach&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
                &amp;lt;div class="card"&amp;gt;
                    &amp;lt;img src="https://images.pexels.com/photos/220201/pexels-photo-220201.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;w=1600"
                        alt=""&amp;gt;
                    &amp;lt;p&amp;gt;My First trip to the space&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;

            &amp;lt;/div&amp;gt;
        &amp;lt;/article&amp;gt;
    &amp;lt;/section&amp;gt;

&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dual Screen APIs are still in the experimental phase; hence these APIs won’t work in real-world devices. In such a case, you can use Viewport Segments Polyfill. This Polyfill is an alternative to JavaScript Viewport Segments API. There is still no alternate API for CSS Spanning Media Queries.&lt;/p&gt;

&lt;p&gt;Another option will be to make your website perfectly responsive for handheld devices like phones. Hence, users can view the website on a Single Screen instead of spanning it across both screens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This questionnaire intends to provide a list of some of the most frequently asked&lt;/em&gt;&lt;/strong&gt; &lt;a href="http://www.lambdatest.com/learning-hub/jenkins-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;Jenkins interview questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;to assist job seekers in preparing for interviews.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  UX in Dual Screen displays
&lt;/h3&gt;

&lt;p&gt;With the introduction of new form factors for devices, there are new challenges for the developers to build their apps and websites that adapt and work well on such devices. But along with the challenges, there are new opportunities to showcase their creativity and use the extra space. But how can you make your website or app better for Dual Screens?&lt;/p&gt;

&lt;p&gt;First, think about how you can fully utilize the Dual Screens. Dual Screen means extra screen real estate to fit your content. Think about making life easy for the User by showing more content and better accessibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s say you are creating an app or websites like Instagram or Facebook. In such apps, you can create a single photo screen such that the post image is fixed on the left while the image caption, comments, and likes are shown on the right screen. This allows users to absorb more content than regular design. The user does not need to scroll below to see the comments. He can check the comments with the image still on the screen.&lt;/p&gt;

&lt;p&gt;Similar things can be done for Video playing websites like YouTube, where you can play a Video on one screen and comments, descriptions, and other important metadata related to the post on the other screen. Thus improving the &lt;strong&gt;User Experience&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Here’s Top 30+&lt;/em&gt;&lt;/strong&gt; &lt;a href="http://www.lambdatest.com/learning-hub/cicd-interview-questions?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=jun_26&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;CI/CD Interview Questions&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;and Answers that will help you boost your confidence in an Interview.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;In 2022, more than 60% of the web traffic was through mobile devices. Every developer and designer must adapt to the changes as the devices evolve.&lt;/p&gt;

&lt;p&gt;In this blog on CSS Website Layouts, we discussed a new generation of devices, the Foldable and Dual Screen Devices. We understood why designing a Foldable or Dual Screen device is difficult and how the new CSS Media query solves our problem. We then saw examples of the new queries and how to use them. Later, we built a small Blog page and made it responsive for Dual Screen devices.&lt;/p&gt;

&lt;p&gt;So next time you are working on your website, don’t forget to test the responsiveness of your CSS Website Layouts on Dual Screen devices. I hope you found this blog on CSS Website Layouts helpful. Happy Coding!&lt;/p&gt;

</description>
      <category>css</category>
      <category>csswebsite</category>
      <category>foldabledevices</category>
      <category>automationtesting</category>
    </item>
    <item>
      <title>A Complete Guide To CSS Houdini</title>
      <dc:creator>Anuraggharat651</dc:creator>
      <pubDate>Wed, 24 May 2023 07:01:50 +0000</pubDate>
      <link>https://dev.to/anuraggharat651/a-complete-guide-to-css-houdini-15bc</link>
      <guid>https://dev.to/anuraggharat651/a-complete-guide-to-css-houdini-15bc</guid>
      <description>&lt;p&gt;As a developer, checking the &lt;a href="https://www.lambdatest.com/feature?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;cross browser compatibility&lt;/a&gt; of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. 🙁&lt;/p&gt;

&lt;p&gt;However, some CSS features outshine others, even though they are in the experimental phase. In the end, developers would want to be early adopters of technology. Talking about early adoption, you should check out CSS Houdini. Like me, many front-end developers are super excited about it since it is considered the future of writing code with CSS. It is considered the most exciting development in CSS since &lt;a href="https://www.lambdatest.com/blog/css-flexbox-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Flexbox&lt;/a&gt; and grid.&lt;/p&gt;

&lt;p&gt;The first question that comes to mind is, “What is so special about CSS Houdini”? Well, it literally gives you the super-power through which you can have tighter control over the styling of web pages. So, let’s look at how you can do much more as a front-end developer with CSS Houdini!&lt;/p&gt;

&lt;p&gt;There have been many advancements in HTML and JavaScript in the last few years. You can now extend HTML and create your components and custom properties. But CSS, there’s nothing much yet! As a developer, you have a lot of constraints while working with CSS. You can only use the properties supported by the browser and have limited control over the styling and layout of the webpage.&lt;/p&gt;

&lt;p&gt;Imagine the possibilities if we are allowed to extend CSS using JavaScript. No restrictions and no rules! Extend CSS as you wish! Adding new features which will be performant and consistent across all browsers will be easy for developers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Mobile&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/mobile-emulator-online?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;emulators online&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;from LambdaTest allows you to seamlessly test your mobile applications, websites,and web apps on mobile browsers and mobile devices.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But what will CSS Houdini do?&lt;/p&gt;

&lt;p&gt;Let’s consider that you want to implement an angled border button in your website, but the existing browsers don’t support it. So instead of waiting for the browser to provide support, you can import the paint worklet directly into your project and apply the angled border and clipping property to your buttons without worrying about browser compatibility. This is as easy as installing a plugin for a feature. You can create a worklet by yourself or use one already created by other developers.&lt;/p&gt;

&lt;p&gt;Like the paint worklet, we have a layout worklet to implement masonry layout, animation API to implement custom animations, and properties API to register custom properties with type checking.&lt;/p&gt;

&lt;p&gt;In this blog, learn what CSS Houdini is, how it handles web page rendering issues, the CSS Houdini APIs, and some practical examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to CSS Houdini
&lt;/h3&gt;

&lt;p&gt;CSS Houdini is an umbrella term for browser APIs that expose certain parts of the CSS rendering engine to the developers. This allows developers to extend CSS without compromising on performance. We can add new features using JavaScript and share them as project modules. Hence developers are no longer restricted to using only the properties supported by the browser.&lt;/p&gt;

&lt;p&gt;For the first time, the developers can extend the various stages present in the browser’s rendering pipeline.&lt;/p&gt;

&lt;p&gt;The main goal of CSS Houdini is to present a set of new APIs to the developers so that they can attach (hook) their code in the CSS engine. This allows the developers to extend the existing CSS with features not yet available on some browsers.&lt;/p&gt;

&lt;p&gt;You might wonder what CSS Houdini has to do with your small website.&lt;/p&gt;

&lt;p&gt;Think of the bigger picture!&lt;/p&gt;

&lt;p&gt;Wouldn’t it be nice if you could get more control over the rendering of your website, use the latest features in CSS without worrying about cross browser compatibility, and import CSS features just like you import modules in JavaScript? This is what Houdini is trying to achieve!&lt;/p&gt;

&lt;p&gt;A Houdini task force comprised engineers from top companies like Google, Microsoft, Apple, HP, and IBM. The aim of this task force was simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How can we improve the developer experience by giving them better control of the rendering process of the web page?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The ultimate goal was to give developers more control over the browser’s rendering process and improve CSS capabilities without compromising performance.&lt;/p&gt;

&lt;p&gt;They achieved this by exposing parts of the CSS engine, allowing developers to build APIs that hook directly into the browser. I have covered the same in the section where the focus is on the problems Houdini is trying to solve. By opening up these parts, developers can extend the stages in the pipeline with JavaScript and add new features.&lt;/p&gt;

&lt;p&gt;So, which are these parts? I will dive deep into it in the subsequent sections of the blog.&lt;/p&gt;

&lt;p&gt;Before we dive deeply into CSS Houdini, let’s understand why we need CSS Houdini in the first place and what problem it is trying to solve.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;New&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/selenium-ide-what-is-it-why-is-it-must-for-every-qa/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;Selenium IDE&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;supports cross browser testing and parallel tests for automation along with record and replay function. Here’s why you shouldn’t miss out on it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why use CSS Houdini?
&lt;/h3&gt;

&lt;p&gt;You might have noticed that it has taken a lot of time for a CSS feature to be available in all browsers since its announcement. Alas, &lt;a href="https://www.lambdatest.com/blog/10-ways-to-avoid-cross-browser-compatibility-issues/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;cross browser compatibility issues&lt;/a&gt; arise since not all the web browsers (and browser versions) support all the available CSS properties (including the ones in the experimental phase).&lt;/p&gt;

&lt;p&gt;In JavaScript, features are added and adopted very quickly, but in CSS, it’s the exact opposite. Ask any CSS developer 😣 It takes a lot of time to propose a new feature, approve it, and wait for all browsers to adopt it and then use it. It took years for our favorite &lt;a href="https://www.lambdatest.com/blog/css-grid/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Grid&lt;/a&gt; to be available in all browsers.&lt;/p&gt;

&lt;p&gt;The other problem is that you might want to use a feature, but it might not be supported in all browsers. In such a case, you choose another workaround which is CSS polyfill.&lt;/p&gt;

&lt;p&gt;Polyfill is a piece of JavaScript code that provides modern features in the older browser that lack support. It acts as a browser fallback for missing properties in older browsers. For example, a polyfill code can provide the CSS outline property in Internet Explorer 7, where the property is not supported.&lt;/p&gt;

&lt;p&gt;As interesting as CSS polyfill sounds, it has a lot of drawbacks.&lt;/p&gt;

&lt;p&gt;The main downside of using a CSS polyfill is that it negatively impacts the browser’s performance. The polyfill code is never as efficient as the native CSS code. Hence it can never work as a replacement.&lt;/p&gt;

&lt;p&gt;To understand the drawback and why CSS Houdini is important, we must first know how a browser loads a web page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Role of Browser Rendering Pipeline
&lt;/h3&gt;

&lt;p&gt;The below image depicts various stages present in the &lt;a href="https://www.lambdatest.com/blog/browser-engines-the-crux-of-cross-browser-compatibility/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;browser rendering engine&lt;/a&gt; pipeline. A web page goes through all these stages before it is displayed on the screen.&lt;/p&gt;

&lt;p&gt;Let’s understand each stage in detail&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_h-ZvHEU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXozSkuQfxOsmD2D1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_h-ZvHEU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXozSkuQfxOsmD2D1.png" alt="image" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  DOM and CSSOM
&lt;/h3&gt;

&lt;p&gt;Whenever a request is sent from the browser, the server returns a web page. This web page is an HTML document. While loading this web page, the browser scans the HTML code and generates a JavaScript object called a Node for every HTML element.&lt;/p&gt;

&lt;p&gt;For example, every ‘div’ generates a JavaScript object from the &lt;strong&gt;HTMLDivElement&lt;/strong&gt; class function. After the browser has gone through the entire page, it builds a tree-like structure of the nodes from the entire document. This tree-like structure is called a &lt;strong&gt;DOM (Document Object Model)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H0UbHQWY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AxbA3cHkkvHJUvXyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H0UbHQWY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AxbA3cHkkvHJUvXyl.png" alt="image" width="600" height="700"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;JavaScript has access to this DOM with the help of DOM APIs. Using these APIs, a developer can manipulate the DOM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Automated&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/automated-functional-testing-what-it-is-how-it-helps/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;Functional Testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tests helps to ensure that your web app works as it was intented to. Learn more about functional tests, and how automating them can give you a faster release cycle.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;![image](&lt;a href="https://cdn-images-1.medium.com/max/800/0*bYRjzkzBOQrcwxZF.png"&gt;https://cdn-images-1.medium.com/max/800/0*bYRjzkzBOQrcwxZF.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s a simple example of how we can change the text inside the &lt;code&gt;&amp;lt; p &amp;gt;&lt;/code&gt; tag using JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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&amp;gt;

    &amp;lt;p id="text"&amp;gt;Hi, there!&amp;lt;/p&amp;gt;

    &amp;lt;button onclick="changeText()"&amp;gt;
        Change Text
    &amp;lt;/button&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function changeText() {

    document.getElementById("text").innerHTML = "Hello World!";

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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&amp;gt;

  &amp;lt;p id="text"&amp;gt;Hi, there!&amp;lt;/p&amp;gt;

  &amp;lt;button onclick="changeText()"&amp;gt;
    Change Text
  &amp;lt;/button&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After reading the HTML file and constructing the DOM, the browser collects all the CSS styles from all the existing sources and builds a &lt;strong&gt;CSSOM&lt;/strong&gt; (Cascading Style Sheet Object Model).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fFffNSf5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_KulFAZ0xEX4Nr29.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fFffNSf5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_KulFAZ0xEX4Nr29.png" alt="image" width="600" height="700"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CSSOM is a CSS representation of DOM. Each node in CSSOM contains the style that will be applied to that particular node in DOM that the &lt;a href="https://www.lambdatest.com/blog/how-pro-testers-use-css-selectors-in-selenium-automation-scripts/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Selector&lt;/a&gt; is targeting.&lt;/p&gt;

&lt;p&gt;First, a final CSS is generated by considering the specificity (overriding some styles if they are repeated); only then is the CSSOM created. CSSOM does not contain elements that are not printed on the screen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Render Tree
&lt;/h3&gt;

&lt;p&gt;In the third step, we combine the DOM and CSSOM to form a render tree. While creating the render tree, the browser checks every node from the root and determines the styles attached to it. Only the elements that are supposed to be present on the screen are added in the render tree nodes.&lt;/p&gt;

&lt;p&gt;If there’s a node with a property display set as none, that node and its descendants are not added to the render tree. Similarly, the head section of the web page contains no visible information and hence is not included in the render tree.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SGqYTR2F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ARinQLGv4M4scMfjj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SGqYTR2F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ARinQLGv4M4scMfjj.png" alt="image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Layout
&lt;/h3&gt;

&lt;p&gt;The layout operation is responsible for calculating the position and dimensions of each node from the render tree. The layout is the process by which the width, height, and location of all nodes in the render tree are determined. In this step, the browser determines the width, height, location, and geometry of each node present in the render tree and creates a layout.&lt;/p&gt;

&lt;p&gt;Layout operation is also called &lt;strong&gt;browser reflow&lt;/strong&gt;. This operation runs every single time the browser viewport is changed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Through this&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/usability-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;usability testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tutorial, you will learn how usability testing is a great way to discover unexpected bugs, find what is unnecessary or unused before going any further, and have unbiased opinions from an outsider.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Paint
&lt;/h3&gt;

&lt;p&gt;Up until now, the browser has created layers of each element separately. In paint operation, the browser works on each layer and fills them with visual elements like borders, colors, backgrounds, fonts, shadows, etc.&lt;/p&gt;

&lt;p&gt;This process is performed on each layer separately. Paint operation is also called rasterization.&lt;/p&gt;

&lt;h3&gt;
  
  
  Composition
&lt;/h3&gt;

&lt;p&gt;In this step, we combine all the layers generated till now and draw them on the screen as a single web page. After the composition operation, the web page is displayed on the browser.&lt;/p&gt;

&lt;p&gt;This sequence of events is called the &lt;strong&gt;critical rendering path&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So let’s quickly summarise&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;DOM is generated from the HTML code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CSSOM is created based on the stylesheets (Internal and External).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DOM and CSSOM are combined to form the render tree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Layers are created based on the render tree in the layout operation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Visual factors are added to each layer in the paint operation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Layers are combined in the composition process and presented on the screen.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once all the critical rendering path steps are completed, JavaScript attached to the code is loaded. However, there is a slight issue with the web page rendering that we typically face. In the next section of this blog, we will explore the issues with the rendering of a web page.&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s the issue with the rendering of a web page?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ypmku1xr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AACj_68zFW2-R8apd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ypmku1xr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AACj_68zFW2-R8apd.png" alt="image" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As seen above, a developer has limited access to DOM and CSSOM. (The degree of access to CSSOM is unspecified in the official docs)&lt;/p&gt;

&lt;p&gt;So if you ever have to write a polyfill for CSS, you cannot plug it into CSSOM directly since you don’t have access to it. You can only plug it inside the DOM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NtQlwCbo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5_ATZi-fLuRlrDGv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NtQlwCbo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5_ATZi-fLuRlrDGv.png" alt="image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This means you have to update the DOM, resulting in a re-rendering of the complete web page. The browser will reinitiate the rendering process whenever you make any DOM changes.&lt;/p&gt;

&lt;p&gt;Re-rendering your website once or twice after you initially load it might sound like a small dent in your website performance. But consider a case where you have written a polyfill that will run every time you scroll. This will make your webpage load multiple times, significantly affecting performance.&lt;/p&gt;

&lt;p&gt;For example, let’s say you created a CSS smooth scroll polyfill function that brings &lt;a href="https://www.lambdatest.com/blog/browser-compatible-smooth-scrolling-with-css-js-jquery/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS smooth scroll property&lt;/a&gt; in old browsers and Internet Explorer. This polyfill function runs every time the browser detects scroll. This makes the web page reload whenever the function is invoked, hence affecting the performance.&lt;/p&gt;

&lt;p&gt;So we need to find a way to modify or extend the CSS without triggering the re-render. That means modifying the rendering cycle without touching the DOM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/learning-hub/black-box-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;Black Box testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;? Don’t worry; we will be covering what is Black box testing, merits, demerits, types &amp;amp; techniques.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How does CSS Houdini handle web page rendering issues?
&lt;/h3&gt;

&lt;p&gt;Houdini introduces a new set of APIs that lets the developers access the parts of the browser rendering pipeline. For the first time, you will have access to the layout, painting, and other processes of the website. Developers can go above the regular CSS styling and create their properties, layout, and animations.&lt;/p&gt;

&lt;p&gt;This extension of the CSS engine is possible due to CSS Houdini APIs. CSS Houdini is a set of APIs that expose parts of the CSS engine.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS Houdini APIs
&lt;/h3&gt;

&lt;p&gt;CSS Houdini consists of two sets of APIs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Low-Level APIs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;High-Level APIs&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These APIs (low-level and high-level) make it easier for developers to create extensions for CSS. These extensions might be to polyfill features that are not yet available in a browser, experiment with new layout methods, or add creative borders or other effects.&lt;/p&gt;

&lt;p&gt;These extensions act as polyfill to provide features that are not yet available in the browser. Using these APIs, developers extend the stages of the CSS rendering pipeline by adding custom JavaScript code and creating custom features like layouts, borders, backgrounds, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XpAXiIwv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AT8iXzKt9tMrPakVM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XpAXiIwv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AT8iXzKt9tMrPakVM.png" alt="image" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Low-Level APIs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These APIs form the foundation of the High-level APIs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Worklets&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Typed Object Model API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Custom Properties API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Font Metrics API&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;High-Level APIs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These High-level APIs represent the four stages of the browser’s rendering pipeline.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Paint API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Layout API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Animation Worklet API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parser API&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As of November 2022, only paint API, custom properties API, and typed object model API is supported in Chromium-based browsers and will be available soon in Firefox and Safari. So only use these supported browsers to check the output of the explained examples.&lt;/p&gt;

&lt;p&gt;Following is the browser support for Houdini APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tp2nNRHk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AfhfEexNhvqLPE0yr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tp2nNRHk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AfhfEexNhvqLPE0yr.png" alt="image" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ishoudinireadyyet.com/"&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;A comprehensive User&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/learning-hub/user-acceptance-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;&lt;strong&gt;&lt;em&gt;Acceptance Testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;(UAT) tutorial that covers what User Acceptance Testing is, its importance, benefits, and how to perform it with real-time examples.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Worklets
&lt;/h3&gt;

&lt;p&gt;A worklet is a lightweight version of a &lt;strong&gt;web worker&lt;/strong&gt; and acts as an &lt;strong&gt;extension&lt;/strong&gt; point of the browser rendering engine for the developers. Each worklet runs in a separate context and has no access to the window, document objects, or high-level functions.&lt;/p&gt;

&lt;p&gt;Worklets run independently of the main thread and can be invoked at any point of the rendering pipeline. Worklets are the JavaScript modules that attach themselves to the browser and make the high-level APIs work. They are imported and registered using a single line of JavaScript.&lt;/p&gt;

&lt;p&gt;Currently, CSS Houdini supports three worklets.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Paint Worklet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Layout Worklet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Animation Worklet&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Importing a paint worklet:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS.paintWorklet.addModule("url-of-worklet");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using an imported worklet:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    body{
     background-color: paint(confetti)
     }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Typed Object Model API
&lt;/h3&gt;

&lt;p&gt;CSS values come with a variety of units. We have &lt;strong&gt;px&lt;/strong&gt;, &lt;strong&gt;rem&lt;/strong&gt;, &lt;strong&gt;em&lt;/strong&gt;, &lt;strong&gt;ch&lt;/strong&gt;, &lt;strong&gt;cm&lt;/strong&gt;, and more! Interacting with so many units is difficult for any developer. Currently, the only way for developers to read and modify CSS values using JavaScript is by parsing them into Strings. This makes it difficult to perform arithmetic operations, and code is more prone to errors.&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;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Lambda Test&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;section&amp;gt;
        &amp;lt;div style="height: 100px;" id="heading"&amp;gt;
            &amp;lt;h1&amp;gt;Lambda Test&amp;lt;/h1&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&amp;lt;script&amp;gt;
    var heading = document.getElementById('heading')
    console.log(heading.style.height)
    console.log(typeof heading.style.height)
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0pW5BmwI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_ARcf-QgqVKqTjXC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0pW5BmwI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_ARcf-QgqVKqTjXC.png" alt="image" width="339" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the above example, the 100px value is a string. So to add any value to it, we need first to parse it into an Integer, perform our operation, and convert it back to a String. This gets even tougher when the unit used is relative, like %, vh/vw.&lt;/p&gt;

&lt;p&gt;Typed Object Model API adds more &lt;strong&gt;semantics&lt;/strong&gt; to the CSS by exposing them as JavaScript objects. Hence instead of taking a CSS value and parsing it into a String, Typed OM APIs provide you with a &lt;strong&gt;JavaScript Object&lt;/strong&gt; with &lt;strong&gt;value&lt;/strong&gt; and &lt;strong&gt;unit&lt;/strong&gt; property. This approach is faster, and the code is more maintainable and less prone to errors.&lt;/p&gt;

&lt;p&gt;Using computedStyleMap() we get an object which consists of the value and the unit. It is easier to perform the calculations and work with a numerical value.&lt;/p&gt;

&lt;p&gt;Here is how we use Typed Object Model API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    //select the container using javascript
var elem = document.getElementById('container')
console.log("Using Typed OM ")
console.log("Height : " + elem.computedStyleMap().get("height"));
console.log("Type of Height = " + typeof elem.computedStyleMap().get("height").value);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xRfh1hfe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A40oo4NezUB-j17oo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xRfh1hfe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A40oo4NezUB-j17oo.png" alt="image" width="496" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;computedStyleMap() method is used for parsing computed properties and attributeStyleMap is used for parsing and modifying inline styles.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Typed Object Model API performs type checking. So if you pass a wrong data type, it will show an error in the console.&lt;/p&gt;

&lt;p&gt;Here’s an example showing how easy it is to interact with CSS properties using the Typed Object Model API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;body&amp;gt;
    &amp;lt;div id="container"&amp;gt;
        &amp;lt;h1 id="heading"&amp;gt;Typed OM using CSS Houdini&amp;lt;/h1&amp;gt;
        &amp;lt;p&amp;gt;Open the console log&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
    background-color: #fefefe;
    display: flex;
    justify-content: center;
    align-items: center;
}

h1 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 30px;
}
div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 400px;
    width: 800px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//select the container using javascript
var elem = document.getElementById("container");

elem.style.height = 500;
console.log(typeof elem.style.height);
//String

//getting styles using Typed OM
console.log(elem.computedStyleMap().get("height"));
console.log(elem.computedStyleMap().get("height").value);
console.log(typeof elem.computedStyleMap().get("height").value);
console.log(elem.computedStyleMap().get("height").unit);

//setting styles using Typed OM
var elemTwo = document.getElementById("heading");
elemTwo.attributeStyleMap.set("font-size", CSS.px(50));

//getting inline-styles
console.log(elemTwo.attributeStyleMap.get("font-size"));

//an error will be thrown if we pass a non string value
//elemTwo.attributeStyleMap.set('font-size', CSS.px(asd))

//Clear all the styles
console.log(elemTwo.attributeStyleMap.clear);
//delete font-size style
console.log(elemTwo.attributeStyleMap.delete("font-size"));
//check if style is present
console.log(elemTwo.attributeStyleMap.has("font-size"));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kiPlEzkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AqOvji7gssZB7NRr1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kiPlEzkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AqOvji7gssZB7NRr1.png" alt="image" width="800" height="418"&gt;&lt;/a&gt;&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 id="container"&amp;gt;
        &amp;lt;h1 id="heading"&amp;gt;Typed OM using CSS Houdini&amp;lt;/h1&amp;gt;
  &amp;lt;p&amp;gt;Open the console log&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I am using &lt;a href="https://www.lambdatest.com/lt-browser/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;LT Browser&lt;/a&gt; — a complementary tool by LambdaTest, to test my output.&lt;/p&gt;

&lt;p&gt;LT Browser is a &lt;a href="https://www.lambdatest.com/mobile-friendly-test?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;mobile-friendly tester&lt;/a&gt; offered by LambdaTest — a continuous quality cloud testing platform for manual and &lt;a href="https://www.lambdatest.com/automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;automated testing&lt;/a&gt; for web and mobile. With LT Browser, you can test your website’s responsiveness on over 50+ device viewports. It supports &lt;a href="https://www.lambdatest.com/learning-hub/responsive-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive testing&lt;/a&gt; on the mobile, tablet, desktop, and even laptops.&lt;/p&gt;

&lt;p&gt;Check out the following tutorial for more details.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/K1dlmU3QWWk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Subscribe to the &lt;a href="https://www.youtube.com/c/LambdaTest?sub_confirmation=1?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=video"&gt;LambdaTest YouTube channel&lt;/a&gt; for tutorials around &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Selenium testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/playwright?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Playwright&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/learning-hub/cypress-tutorial?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;Cypress&lt;/a&gt;, and more.&lt;/p&gt;

&lt;p&gt;LT Browser provides tons of amazing features like&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Check the mobile view of your websites.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compare the side-by-side view of the website on different viewports&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generate performance reports of your websites.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Network simulation to test websites across varying networks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Perform one-click bug logging and video recording of test sessions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We recently went live with the beta version of our all-new &lt;a href="https://www.lambdatest.com/blog/lt-browser-2-0/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;Chromium-based LT Browser 2.0&lt;/a&gt;, which has several new features and enhancements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Run your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;Selenium online&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Automation Testing scripts on the LambdaTest cloud grid. Test on 3000+ desktop &amp;amp; mobile environments. Try it for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Along with the Object, we also get useful methods like &lt;em&gt;clear, delete,&lt;/em&gt; and &lt;em&gt;has&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  //Clear all the styles
  console.log(elemTwo.attributeStyleMap.clear)
  //delete font-size style    
  console.log(elemTwo.attributeStyleMap.delete('font-size'))
  //check if style is present        
  console.log(elemTwo.attributeStyleMap.has('font-size'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Custom Properties and Values API
&lt;/h3&gt;

&lt;p&gt;Custom properties and values API allows developers to create CSS properties with &lt;strong&gt;data types&lt;/strong&gt;, &lt;strong&gt;initial values&lt;/strong&gt;, and &lt;strong&gt;inheritance rules&lt;/strong&gt;. Developers can register these properties using the ‘&lt;em&gt;registerProperty()&lt;/em&gt;’ method or the &lt;em&gt;‘@property&lt;/em&gt;’ rule.&lt;/p&gt;

&lt;p&gt;CSS Custom Properties API extends the CSS variables and adds Type checking. You can add a variable in the ‘&lt;em&gt;:root{}&lt;/em&gt;’ block and use it throughout your CSS file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  :root {
   --primary-color: blue;
}
body {
    background-color: var(--primary-color);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One of the downsides of using a regular &lt;a href="https://www.lambdatest.com/blog/guide-to-css-variables-with-examples/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS variable&lt;/a&gt; is that there is no type checking. So if the browser encounters a value that does not match the expected property value type. It directly discards the property.&lt;/p&gt;

&lt;p&gt;The other drawback of using a regular CSS variable is that we can’t animate the property. The browser does not know what the expected type of the property is hence it is unable to handle the animations. But registered properties allow us to handle &lt;a href="https://www.lambdatest.com/blog/css-animations-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_23&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS animations&lt;/a&gt; since they come with a type.&lt;/p&gt;

&lt;p&gt;You can create your &lt;strong&gt;custom CSS property&lt;/strong&gt; in two ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using the &lt;strong&gt;&lt;em&gt;registerProperty()&lt;/em&gt;&lt;/strong&gt; method in your JavaScript file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  CSS.registerProperty({
    name: "name-of-property",
    syntax: "&amp;lt;property-type&amp;gt;",
    inherits: false / true,
    initialValue: "initial-value",
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Using &lt;strong&gt;&lt;em&gt;@property&lt;/em&gt;&lt;/strong&gt; in your CSS file
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  @property --property-name {
      syntax: "&amp;lt;property-type&amp;gt;";
      inherits: false/true;
      initial-value: initial-value;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s take an example to understand CSS custom property. In this example, we will create two custom properties. One with the &lt;em&gt;registerProperty()&lt;/em&gt; method and another with the &lt;em&gt;@property&lt;/em&gt; rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;body&amp;gt;

    &amp;lt;h1&amp;gt;CSS CUSTOM PROPERTY&amp;lt;/h1&amp;gt;

&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@property --primaryColor {
    syntax: "&amp;lt;color&amp;gt;";
    inherits: false;
    initial-value: teal;
}

body {
    height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--primaryColor);
    color: var(--textColor)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS.registerProperty({
  name: "--textColor",
  syntax: "&amp;lt;color&amp;gt;",
  inherits: false,
  initialValue: "orange",
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2ZnyWt08--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AS0tt8WEkRDr04Te3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2ZnyWt08--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AS0tt8WEkRDr04Te3.png" alt="image" width="800" height="417"&gt;&lt;/a&gt;&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;body&amp;gt;

  &amp;lt;h1&amp;gt;CSS CUSTOM PROPERTY &amp;amp; VALUES API&amp;lt;/h1&amp;gt;

&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Font Metrics API
&lt;/h3&gt;

&lt;p&gt;According to the documentation, font metrics API will contain methods that will allow the developers to measure the &lt;strong&gt;dimensions&lt;/strong&gt; of the textual elements that are being rendered on the screen. For example, using this API, you can perform text truncation on multiple line text elements.&lt;/p&gt;

&lt;p&gt;Currently, this API is still in a very early stage of development, so there is a high chance that the specifications and features may change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Run your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;Selenium Automation Testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;scripts on the LambdaTest cloud grid. Test on 3000+ desktop &amp;amp; mobile environments. Try it for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Paint API
&lt;/h3&gt;

&lt;p&gt;CSS paint API allows developers to generate graphics using JavaScript functions during the Paint stage of the browser’s rendering pipeline. This is achieved with the help of Paint Worklet. In the Background, Paint API uses the &lt;strong&gt;CanvasRenderingContext2D&lt;/strong&gt;, which is the subset of &lt;strong&gt;HTML5 Canvas API&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Using a paint worklet, you can create custom &lt;strong&gt;backgrounds&lt;/strong&gt;, &lt;strong&gt;borders&lt;/strong&gt;, &lt;strong&gt;outline&lt;/strong&gt;s, and more! You can define your own custom painting functions or use the existing worklets created by other developers.&lt;/p&gt;

&lt;p&gt;This API has the best support and is enabled in all the Chromium-based browsers, under consideration for Firefox and in the development stage for Safari. You can use the &lt;em&gt;paint()&lt;/em&gt; function as a value to the CSS properties and pass the registered Paint worklet.&lt;/p&gt;

&lt;p&gt;Here the developers define the paint functions and use them as CSS properties in their CSS file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create your own worklet using the registerPaint() method or link an already created worklet using CDN.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;registerPaint("name-of-worklet", {
  //..code
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Register and add it to your project using the &lt;em&gt;addModule()&lt;/em&gt; method.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS.paintWorklet.addModule(“path-to-worklet.js-file”);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use the &lt;em&gt;paint()&lt;/em&gt; function as a CSS value to the background property.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.demo {
    background: paint(name-of-worklet);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add a polyfill script to ensure the worklet runs on all old browsers.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="cdn-link-to-polyfill-file.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, let’s take an example and show you the possibilities of paint API. For this example, we will use already created worklets. There are lots of cool worklets to choose from. I loved the static gradient one, so I’ll use that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;section&amp;gt;
    &amp;lt;div class="demo"&amp;gt;
        &amp;lt;h1&amp;gt;PAINT WORKLET - CSS Houdini&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&amp;lt;script src="https://unpkg.com/Houdini-static-gradient/worklet.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    background-color: #222;
}

section {
    height: 100vh;
    width: 100%;
}

div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo {
    background: paint(static-gradient);
    --static-gradient-size: 5;
    --static-gradient-color: #7743DB;
    --static-gradient-direction: to-bottom;
}

h1 {
    font-size: 3rem;
    color: #fff;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  CSS.paintWorklet.addModule('https://unpkg.com/Houdini-static-gradient/worklet.js')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&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;section&amp;gt;
        &amp;lt;div class="demo"&amp;gt;
            &amp;lt;h1&amp;gt;PAINT WORKLET - CSS Houdini&amp;lt;/h1&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;

&amp;lt;script src="https://unpkg.com/houdini-static-gradient/worklet.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can get a lot creative with the paint API. The possibilities are limitless. Check out these two examples that I created using paint API. I went a step ahead and added keyframes animation to it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the code for our first example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;section&amp;gt;
    &amp;lt;div class="demo"&amp;gt;
        &amp;lt;h1&amp;gt;CSS Houdini is Awesome!&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;

&amp;lt;script src="https://unpkg.com/extra-confetti/worklet.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; body {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
        background-color: #222;
    }

    section {
        height: 100vh;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    div {
        width: 1000px;
        height: 500px;
        background-color: aquamarine;
        display: flex;
        align-items: center;
        justify-content: center;


    }

    .demo {
        background: paint(extra-confetti);
        --extra-confettiNumber: 20;
        --extra-confettiLengthVariance: 20;
        --extra-confettiWeightVariance: 10;
        animation: animateConfetti 1s infinite;
    }

    h1 {
        font-size: 5rem;
        color: #fff;
    }

    @keyframes animateConfetti {
        0% {
            --extra-confettiNumber: 20;

        }

        50% {
            --extra-confettiNumber: 60;
        }

        100% {
            --extra-confettiNumber: 100;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS.paintWorklet.addModule("https://unpkg.com/extra-confetti/worklet.js");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uJaydRwD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATlgN2vafQ_JYck01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uJaydRwD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATlgN2vafQ_JYck01.png" alt="image" width="800" height="421"&gt;&lt;/a&gt;&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;section&amp;gt;
        &amp;lt;div  class="demo"&amp;gt;
            &amp;lt;h1&amp;gt;CSS Houdini Paint API Example!&amp;lt;/h1&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;

   &amp;lt;script src="https://unpkg.com/extra-confetti/worklet.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 2&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now let’s look at the code for our second example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;section class="demo"&amp;gt;

&amp;lt;/section&amp;gt;

&amp;lt;script src="https://unpkg.com/Houdini-alien@0.1.1/AlienPainter.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; body {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    section {
        height: 100vh;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .demo {
        background-image: paint(alien);
        --alien-bg-color: #222;
        --alien-fg-color: #f321f1;
        --alien-grid-size: 2;
        animation: animateAlien 2s infinite;

    }

    @keyframes animateAlien {
        0% {
            --alien-grid-size: 2;
        }

        25% {
            --alien-grid-size: 3;
        }

        50% {
            --alien-grid-size: 4;
        }

        75% {
            --alien-grid-size: 3;
        }

        100% {
            --alien-grid-size: 2;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS.paintWorklet.addModule(
  "https://unpkg.com/Houdini-alien@0.1.1/AlienPainter.js"
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iKNVlMtn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXmRZOYKPW6V1V7TC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iKNVlMtn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXmRZOYKPW6V1V7TC.png" alt="image" width="800" height="430"&gt;&lt;/a&gt;&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;section class="demo"&amp;gt;

    &amp;lt;/section&amp;gt;
    &amp;lt;script&amp;gt;
        CSS.paintWorklet.addModule('https://unpkg.com/houdini-alien@0.1.1/AlienPainter.js')
    &amp;lt;/script&amp;gt;
&amp;lt;script src="https://unpkg.com/houdini-alien@0.1.1/AlienPainter.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Layout API
&lt;/h3&gt;

&lt;p&gt;CSS layout API allows the developers to create their own &lt;strong&gt;Display&lt;/strong&gt; properties. This API extends the layout stage of the browser’s rendering pipeline. Layout API will make creating new and complex layouts easy for developers.&lt;/p&gt;

&lt;p&gt;Similar to the paint API, the layout worklet needs to be registered before it can be used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;registerLayout(
  "mylayout",
  class {
    //code for the layout
  }
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once registered, you can add the layout API in your HTML file using the add method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS.layoutWorklet.addModule('path-to-layout-worklet');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, use the layout function against the display property in your CSS file.&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: layout(mylayout);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Currently, layout API is not supported in all browsers; hence we won’t be able to see a working demo.&lt;/p&gt;

&lt;h3&gt;
  
  
  Animation API
&lt;/h3&gt;

&lt;p&gt;Animation API improves the performance of web animations by running them on their own worklet. This API is the extension of the &lt;strong&gt;Composite&lt;/strong&gt; stage of the browser’s rendering pipeline. The API allows the developers to generate KeyframeEffect animations based on user inputs like a &lt;strong&gt;scroll&lt;/strong&gt;, &lt;strong&gt;hover&lt;/strong&gt;, and &lt;strong&gt;click&lt;/strong&gt;. These animations are non-blocking and more performant than the existing ones since they run off the main thread(on their own worklet).&lt;/p&gt;

&lt;p&gt;Similar to the other worklets, the animation worklet needs to be registered first.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;registerAnimator(
  "myanimation",
  class {
    //code for custom animation
  }
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add it as a module in your main JavaScript file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSS.animationWorklet.addModule("path-to-animation-worklet");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Animation API has partial support in &lt;strong&gt;Chromium-based&lt;/strong&gt; browsers and is not supported by Firefox and Safari, so we won’t be able to see a working demo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/cypress-test-automation-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=may_24&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;Cypress test automation&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tutorial will help you learn the benefits of Cypress automation, and how to install Cypress and execute Cypress automation testing over scores of browsers and operating systems online.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Parser Worklet
&lt;/h3&gt;

&lt;p&gt;Parser worklet extends the parsing stage of the browser’s rendering pipeline and is built on top of the Typed Object Model. The goal of this API is to allow the Developer access to the Rendering Engine’s Parser. With this API, you can create new rules, perform &lt;strong&gt;nesting&lt;/strong&gt;, &lt;strong&gt;extend CSS&lt;/strong&gt; and apply &lt;strong&gt;external properties&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Currently, this API is not implemented; hence the specifications aren’t clear. But this API has a massive scope since developers can extend the CSS parsing phase and directly tell the browser what CSS property follows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I am very excited about CSS Houdini APIs. How cool is it that the developers get access to all the rendering pipeline stages? This means more control and power in the hands of the developers. All these new APIs and worklets have opened a new world of possibilities. You are now not restricted to the browser-supported CSS properties. You can create your own CSS property polyfills or use the ones already created without worrying about browser compatibility. This will make the developer experience a lot better.&lt;/p&gt;

&lt;p&gt;CSS Houdini is still in the early stages of development but has shown the potential to change how developers write the styles. This is still the surface; there are a lot more APIs that are yet to be announced. As a developer, the CSS Houdini project is one of the most exciting projects to look forward to in the upcoming years.&lt;/p&gt;

&lt;p&gt;I hope you learned something new and exciting from this blog. CSS has always been a tricky topic for all developers. So many new features are coming up, and it is vital to stay updated on them. It’s time to use some of the APIs mentioned above in your projects!&lt;/p&gt;

</description>
      <category>css</category>
      <category>csshoudini</category>
      <category>automationtesting</category>
      <category>cloudtesting</category>
    </item>
    <item>
      <title>CSS Content-Visibility: A Game-Changer For Web Page Loading Speed</title>
      <dc:creator>Anuraggharat651</dc:creator>
      <pubDate>Tue, 25 Apr 2023 09:18:02 +0000</pubDate>
      <link>https://dev.to/anuraggharat651/css-content-visibility-a-game-changer-for-web-page-loading-speed-30p9</link>
      <guid>https://dev.to/anuraggharat651/css-content-visibility-a-game-changer-for-web-page-loading-speed-30p9</guid>
      <description>&lt;p&gt;The adage “First Impression is the Last Impression” is one that I’m pretty sure you’ve heard before. Well, I don’t know if it’s true in the case of people, but it applies to websites. A visitor’s first impression of a website is generally based on how fast the site loads and how smoothly it interacts. A slow or sluggish website stays in the visitors’ minds and might affect their decision to revisit the site.&lt;/p&gt;

&lt;p&gt;According to developer Mozilla documentation, visitors on a website generally expect a website to load within a couple of seconds and abandon the site if it takes more than 3 seconds. Hence as a developer, we need to make a maximum impact in the minimum time to make the visitor stay on the site.&lt;/p&gt;

&lt;p&gt;Website performance is an essential factor in determining whether the visitors stay on our website or move to another one. With so many businesses going online, a website becomes a focal point for gaining customers and creating an online identity. In such cases, a poorly performing website can negatively impact the business. Whereas a highly performant and optimized website results in better conversion rates and better customer retention.&lt;/p&gt;

&lt;p&gt;Hence as a developer, improving the performance of our website must be our topmost priority. Web Optimization is a process of improving the performance and experience on a site using optimization techniques, strategies, and technologies to drive more audience and meet the business goals.&lt;/p&gt;

&lt;p&gt;Website Optimization techniques can be performed on the client and server sides. Techniques such as lazy loading images, improving database read/write times, and caching JavaScript files are popular among developers. As per the HubSpot survey, you can reduce your website’s initial render time by more than 80% using a single line of CSS code.&lt;/p&gt;

&lt;p&gt;The new CSS &lt;em&gt;content-visibility&lt;/em&gt; property directly interacts with the browser’s rendering process to improve the website’s performance. In this blog, we will understand how to leverage the CSS &lt;em&gt;content-visibility&lt;/em&gt; property to enhance the website’s performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Which are the most wanted&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/automation-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;tools for automation testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;that have climbed the top of the ladder so far? Let’s take a look&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does Website Performance matter?
&lt;/h3&gt;

&lt;p&gt;Having a website that works well is beneficial. An interactive website with quick responses draws visitors more readily. Visitors will go to another website if yours takes longer to load. A user will trust a website that loads quickly. One finding is that a fast website has a higher rate of customer retention.&lt;/p&gt;

&lt;p&gt;Here are some reasons website performance matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User experience:&lt;/strong&gt; Users expect websites to load swiftly and without interruption. High bounce rates can result from users becoming impatient with a slow or poorly functioning website. As a result, users may be less likely to revisit your website, harming your brand’s reputation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Search engine rankings:&lt;/strong&gt; Website speed affects rankings on search engines like Google. In addition to making it more difficult for users to find your site, a slow website can harm your search engine rankings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Conversion rates:&lt;/strong&gt; Having a website that loads quickly and responds to user input can increase conversion rates. Visitors are more likely to purchase or complete the desired action on a website that is quick and simple to use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mobile responsiveness:&lt;/strong&gt; Website performance is increasingly important as mobile users use these devices to access websites. Mobile users anticipate quick page loads and seamless browsing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optimize images:&lt;/strong&gt; Your website may load slowly if the images are large. Make sure to optimize your images by minimizing their file size without compromising on quality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Minimize HTTP requests:&lt;/strong&gt; Every file request made by a website takes time to load. You can minimize HTTP requests by combining multiple files into one, using CSS sprites, and using browser caching.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use a content delivery network (CDN):&lt;/strong&gt; A CDN can help improve website performance by caching content on multiple servers worldwide, reducing the distance between the server and the user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Minify CSS and JavaScript:&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/css-minify?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Minifying CSS&lt;/a&gt; and JavaScript files by removing whitespace and comments can reduce file sizes and speed up website load times.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use a fast and reliable web hosting service:&lt;/strong&gt; The speed of a website can be significantly impacted by its web host. Use a fast, dependable web hosting service that can manage the traffic to your website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Implement lazy loading:&lt;/strong&gt; Your website may load slowly if the images are large. Make sure to optimize your images by minimizing their file size without compromising on quality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use responsive design:&lt;/strong&gt; Your website must have a &lt;a href="https://www.lambdatest.com/learning-hub/responsive-design?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive design&lt;/a&gt; to look good and work properly across all platforms, including desktops, tablets, and mobile phones.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test your website regularly:&lt;/strong&gt; Regularly testing your website’s performance can help you identify and fix issues before they become significant problems.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By implementing these tips, you can enhance the functionality of your website, which will raise user engagement, boost search engine rankings, and increase conversion rates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Which are the most wanted&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/blog/automation-testing-tools/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;&lt;strong&gt;&lt;em&gt;automation testing tools&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;that have climbed the top of the ladder so far? Let’s take a look.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Meanwhile, you can also go through the below LT Browser 2.0 tutorial.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to CSS content-visibility property
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;em&gt;content-visibility&lt;/em&gt; property introduced in Chromium 85 is one of the most impactful properties for improving a website’s performance. This property allows the developers to decide which part of the webpage should render and which part should be skipped on the initial render.&lt;/p&gt;

&lt;p&gt;When we talk about content on websites, we can divide it into two parts or sections. One section is directly visible and accessible to the user on the initial load, and the other is only visible after user interaction, like scrolling down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R2AKRBPE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AsPVctp-S9J-Nj0ye.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R2AKRBPE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AsPVctp-S9J-Nj0ye.png" alt="image" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here I have taken a screenshot of the LambdaTest website. As shown in the above image, the section above the red threshold is directly visible to the user whenever he opens the website. All the HTML elements present in this section of the website can be called onscreen elements.&lt;/p&gt;

&lt;p&gt;Whereas the section below the red threshold line is not directly visible to the user. The user has to scroll down to view it. The HTML elements in this section of the website that are not visible directly can be called offscreen elements.&lt;/p&gt;

&lt;p&gt;Hence by only rendering the content above the threshold and delaying the rendering process of the content present below the threshold, we can speed up the overall rendering of the website. A reduced rendering time will result in better load times and better performance on the initial render.&lt;/p&gt;

&lt;p&gt;This is exactly what the CSS &lt;em&gt;content-visibility&lt;/em&gt; property is all about. Using this property, a browser can skip the rendering of a part of the webpage which is not present directly in the user’s viewport. This indicates that if the element is present in the user’s viewport at the time of the first load, it is rendered; otherwise, it is skipped until the element is brought into the user’s viewport. We can think of this as a lazy load for all the content on the website.&lt;/p&gt;

&lt;p&gt;The CSS &lt;em&gt;content-visibility&lt;/em&gt; property allows browsers to defer the layout and rendering work of off-screen elements, making the initial page load faster. Our offscreen content will only be loaded once we visit it. This results in improved initial load time, and our on-screen content is quickly available for the user to interact with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uYK0XNBo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Atrj2_iGgxn4xusT7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uYK0XNBo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Atrj2_iGgxn4xusT7.png" alt="image" width="512" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Critical Rendering Path in a browser is a series of stages, like layout, styling, painting, etc., that a browser goes through to convert the HTML, CSS, and JavaScript into pixels on the screen. The CSS &lt;em&gt;content-visibility&lt;/em&gt; property reduces the number of elements to be rendered during the render phase of the critical rendering path.&lt;/p&gt;

&lt;p&gt;The CSS &lt;em&gt;content-visibility&lt;/em&gt; property accepts one of the below three values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; content-visibility: [visible | auto | hidden];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  content-visibility: visible
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;This is the default value and does not affect the rendering of the webpage. The entire webpage is loaded on the initial load.&lt;/p&gt;

&lt;h3&gt;
  
  
  content-visibility: hidden
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;This CSS &lt;em&gt;content-visibility&lt;/em&gt; value is the perfect mixture of two different CSS properties — &lt;em&gt;visibility: hidden&lt;/em&gt; and &lt;em&gt;display: none&lt;/em&gt;. Using &lt;em&gt;content-visibility&lt;/em&gt;: hidden, the browser hides the element, but the render state is still preserved in the cache. As a result, whenever the property changes, the browser does not have to re-render the element, reducing load time.&lt;/p&gt;

&lt;p&gt;We can use this property when showing an element that is initially hidden but has to be shown quickly on screen after some user interaction. A modal would be a perfect use case for &lt;em&gt;content-visibility&lt;/em&gt;: hidden property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Perform browser automation testing on the most powerful cloud infrastructure. Leverage LambdaTest automation testing for faster, reliable and scalable experience on the&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;test automation cloud&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  content-visibility: auto
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;If this property is applied to the element and the element is not present in the user’s viewport, the browser simply skips the rendering of that element. This property turns on layout, style, and paint containment.&lt;/p&gt;

&lt;p&gt;But unlike CSS &lt;em&gt;content-visibility&lt;/em&gt;: hidden, the element is still available to the user on screen. Hence search and find operations can still be performed on the elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using CSS content-visibility property to Improve Website’s Performance
&lt;/h3&gt;

&lt;p&gt;Normally, the browser loads the entire webpage on the initial load. This means that all the elements on the webpage go through the scripting, rendering, layout, and painting stages in the Critical Rendering Path. Hence the browser takes a lot of time to load the website for the first time. The load time can increase more if the website is multimedia-heavy and has a lot of scripts running in the background.&lt;/p&gt;

&lt;p&gt;The CSS &lt;em&gt;content-visibility&lt;/em&gt;: auto property solves this problem for us. When CSS &lt;em&gt;content-visibility&lt;/em&gt; is set as auto for an element, the browser skips the rendering phase of that element on the initial load. The element is only loaded when it enters the user’s viewport. Until then, the browser only calculates the dimensions of the elements. Hence only the elements that are required on the initial load and visible to the user are rendered.&lt;/p&gt;

&lt;p&gt;This boosts the website performance because the browser can now defer the rendering of the elements until they are required.&lt;/p&gt;

&lt;p&gt;Even after using the CSS &lt;em&gt;content-visibility:&lt;/em&gt; auto property, our content is still available in the &lt;a href="https://www.lambdatest.com/blog/document-object-model/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;DOM&lt;/a&gt; tree. Therefore we can still search for our content and navigate to it before it even loads without sacrificing the performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Difference between Content-Visibility and Lazy Loading
&lt;/h3&gt;

&lt;p&gt;A website’s images are an essential component. In some cases, they even account for the bulk of the website’s content. Although necessary and unavoidable, images also contribute to the website’s lag time. Bulky images can make it take longer for the page to load overall.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QbopYZSV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5oMEu8wJKazOxIi2.png%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QbopYZSV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5oMEu8wJKazOxIi2.png%2520align%3D%2522left%2522" alt="" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Source&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The above image is taken from Addy Osmani and perfectly demonstrates the difference between default behavior vs. when the lazy load is applied. Instead of fetching all the images together, only the required images are fetched; hence the page load is completed in half the time.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.lambdatest.com/blog/how-to-lazy-load-images-javascript/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;Lazy loading&lt;/a&gt; technique is used in websites to improve performance by delaying the fetch request of the images present on the site. Hence, images not directly present in the user’s viewport can be fetched later using the &lt;em&gt;loading=”lazy”&lt;/em&gt; attribute.&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;img src="link-to-image" loading="lazy"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although the CSS &lt;em&gt;content-visibility&lt;/em&gt; and lazy loading properties are both website optimization techniques and sound similar, there is a lot of difference between them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lazy loading can only be applied to the images, while CSS &lt;em&gt;content-visibility&lt;/em&gt; can be applied to any HTML element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lazy loading delays the request of images, whereas CSS &lt;em&gt;content-visibility&lt;/em&gt; requests the data but delays the rendering until it’s needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lazy loading is an HTML image tag attribute, whereas CSS &lt;em&gt;content-visibility&lt;/em&gt; is a property.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How to use CSS content-visibility property?
&lt;/h3&gt;

&lt;p&gt;Before using the CSS &lt;em&gt;content-visibility&lt;/em&gt; property, we must first identify which parts of the website are directly visible to the user and which are accessible only after the scroll. The parts directly in the user’s viewport can usually be rendered. In contrast, for the ones which are off-screen and not directly visible to the user, we can apply content-visibility: auto.&lt;/p&gt;

&lt;p&gt;In this section, we will take an existing website and analyze its performance using Chrome DevTools. Then we will add the CSS &lt;em&gt;content-visibility&lt;/em&gt; property and check the improvement in the rendering time.&lt;/p&gt;

&lt;p&gt;In an example or demo, we will use a CodePen example of a dummy travel blog website from Una Kravets. This is a pretty simple Single Page Website (SPA) with lots of images and content, which is perfect for our demo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Run your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;Selenium Automation&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Testing scripts on the LambdaTest cloud grid. Test on 3000+ desktop &amp;amp; mobile environments. Try it for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Before using the CSS content-visibility property
&lt;/h3&gt;

&lt;p&gt;Before measuring the performance, it is essential to note that the final output of the website’s performance might vary depending on your Internet speeds. The following numbers were achieved on my browser with the Internet speed, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w2Z446yX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_bxzpaBnrO_bpjEv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w2Z446yX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A_bxzpaBnrO_bpjEv.png" alt="image" width="512" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s check the initial performance of the website without any optimization. To check the website performance, we will load our website in the Chrome browser and open the DevTools using &lt;em&gt;Ctrl + Shift + I&lt;/em&gt;. Now we will switch to the performance tab to calculate the performance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y482up4p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A42ca_vdud99eAy2q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y482up4p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A42ca_vdud99eAy2q.png" alt="image" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the reload button to record the page load statistics. The browser will run the initial load for the website. Here is what the website performance looks like in my browser without applying any optimizations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--inAdXrjt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVfJOjmILVqfvzkCY.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--inAdXrjt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AVfJOjmILVqfvzkCY.jpg" alt="image" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, checking for the initial render time, we got these values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aw3krLJS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A0DA3zdgfCcqiZ3ld.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aw3krLJS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A0DA3zdgfCcqiZ3ld.jpg" alt="image" width="772" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the image above, the rendering time is &lt;strong&gt;340 ms&lt;/strong&gt;, and the total load time is&lt;br&gt;&lt;br&gt;
&lt;strong&gt;74673 ms&lt;/strong&gt;. Let’s understand what happens behind the screen.&lt;/p&gt;

&lt;p&gt;The server receives a request from the browser and returns a webpage consisting of an HTML file. This HTML file is parsed, and a DOM and &lt;a href="https://www.lambdatest.com/blog/css-object-model/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSSOM&lt;/a&gt; are generated. Later on, during the rendering stage of the process, a render tree is created by combining the DOM and CSSOM. Once the render tree is generated, the browser performs the remaining layout and painting operations and displays the webpage on the screen.&lt;/p&gt;

&lt;p&gt;During the rendering stage of the process, the browser does not check if the content is visible to the user or if the content is needed by the user on the initial load. It continues the operation until the entire webpage is loaded and resources are downloaded.&lt;/p&gt;

&lt;p&gt;The rendering time will be even more if our webpage has even more images and content since it will take more time for the assets to be downloaded from the network and placed in their place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Run your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;Selenium online&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Automation Testing scripts on the LambdaTest cloud grid. Test on 3000+ desktop &amp;amp; mobile environments. Try it for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now let’s see how we can improve the performance of our webpage using the CSS &lt;em&gt;content-visibility&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;First, we will break down the page into two parts –&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Visible to the user&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not visible to the user&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JAvtFWQO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXF1Wp0LDpKocFIUX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JAvtFWQO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AXF1Wp0LDpKocFIUX.png" alt="image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above image, we have broken down the page into parts/sections. If we analyze the website properly, we can see that we only need the first fold and the main section on the initial load. All the other content below it can be rendered later once the user scrolls since they don’t fall directly into the user’s viewport on the initial load.&lt;/p&gt;
&lt;h3&gt;
  
  
  After using the CSS content-visibility property
&lt;/h3&gt;

&lt;p&gt;We will add an &lt;em&gt;off-screen&lt;/em&gt; class to all the div tags we want to skip during the render stage. For all these off-screen elements, we will set the CSS &lt;em&gt;content-visibility&lt;/em&gt; as auto-using the &lt;em&gt;off-screen&lt;/em&gt; class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.off-screen{
    content-visibility: auto;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s measure the web page’s performance after using the CSS &lt;em&gt;content-visibility&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V21V-Y_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2r236_bnILAj8Srl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V21V-Y_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A2r236_bnILAj8Srl.jpg" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now here, measuring the performance of the travel blog after optimization using the CSS &lt;em&gt;content-visibility&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0B-_Baz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AGd1wutugaVDZ2dCr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0B-_Baz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AGd1wutugaVDZ2dCr.jpg" alt="image" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s an 8X performance boost using a single line of CSS code. We brought the initial render time down from &lt;strong&gt;340 ms&lt;/strong&gt; to &lt;strong&gt;60 ms&lt;/strong&gt;. We reduced the render time by almost &lt;strong&gt;80%&lt;/strong&gt;! But what caused such a huge impact?&lt;/p&gt;

&lt;p&gt;Here the browser still performs the same operations as it did before. The entire web page goes through the Critical Rendering Path as it did before. But the only difference is during the rendering stage. During the rendering stage, once the browser encounters the CSS &lt;em&gt;content-visibility&lt;/em&gt; property applied to the element, it simply skips the rendering of that element.&lt;/p&gt;

&lt;p&gt;The browser will render only the elements on-screen, i.e., visible to the users. The other elements (with class ‘off-screen’) only go through the styling and layout stage and will only be rendered on the screen once they appear in the user’s viewport. Using this technique, rendering of a large portion of the webpage is skipped, and hence we get such a big jump in rendering time and overall performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&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;!-- Website --&amp;gt;
&amp;lt;nav&amp;gt;
  &amp;lt;a href="#"&amp;gt;My Travel Site&amp;lt;/a&amp;gt;
  &amp;lt;ul class="grid-3"&amp;gt;
    &amp;lt;li&amp;gt;Home&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;About&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;Archive&amp;lt;/li&amp;gt;
  &amp;lt;/ul&amp;gt;
&amp;lt;/nav&amp;gt;
&amp;lt;article&amp;gt;
  &amp;lt;h1&amp;gt;The Ultimate Weekend Road Trip Guide&amp;lt;/h1&amp;gt;

&amp;lt;figure class="hero"&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/1600x980" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;This Demo Uses Images from the &amp;lt;a href="https://unsplash.com"&amp;gt;Unsplash&amp;lt;/a&amp;gt; API.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p class="leading"&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;blockquote&amp;gt;Harum quo &amp;lt;i&amp;gt;distinctio facilis&amp;lt;/i&amp;gt; dolorem. Consectetur iste repellendus impedit&amp;lt;/blockquote&amp;gt;

&amp;lt;p&amp;gt;Harum quo distinctio facilis dolorem. Consectetur iste repellendus impedit, odio, corrupti aliquid officia molestiae hic mollitia, omnis aperiam quos enim alias doloribus sint libero ipsa numquam reprehenderit laudantium voluptatibus voluptates!&amp;lt;/p

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x920" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;h2&amp;gt;Make sure you're stocked up on snacks&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/410" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/411" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/430" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. &amp;lt;i&amp;gt;Sint, qui doloremque sit voluptate quis voluptatum&amp;lt;/i&amp;gt;, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;iframe src="https://codepen.io" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;p&amp;gt;Ex provident eos expedita odio quas, et rem nemo voluptatibus necessitatibus ab, voluptatum nam nesciunt impedit sint repellendus, dolorem cumque vero! Ipsa minus perspiciatis dolores! Magnam assumenda quidem itaque totam?&amp;lt;/p&amp;gt;

&amp;lt;ul&amp;gt;
  &amp;lt;li&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit.&amp;lt;/li&amp;gt;
  &amp;lt;li&amp;gt;Aut expedita magni, provident tenetur non voluptatem culpa nesciunt deleniti dolor amet ducimus a quis veniam nisi odit ex cupiditate sunt.&amp;lt;/li&amp;gt;
  &amp;lt;li&amp;gt;Fugit illo illum sapiente neque id soluta sunt error harum nulla qui blanditiis, nemo perspiciatis nesciunt, voluptate voluptates excepturi ipsa sequi vero vitae.&amp;lt;/li&amp;gt;
  &amp;lt;li&amp;gt;Debitis aperiam ipsa hic quibusdam animi ipsum.&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;

&amp;lt;p&amp;gt;&amp;lt;a href="#"&amp;gt;Atque similique&amp;lt;/a&amp;gt; quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/620" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/610" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/800x400" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, &amp;lt;a href="#"&amp;gt;doloremque debitis&amp;lt;/a&amp;gt; deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x900"&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quam modi tempora perferendis. Repellendus, facere accusamus. Distinctio, sit! Cupiditate voluptatibus at id eos nulla consequuntur, dicta animi aut, reiciendis minus hic?&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Don't forget to plan your stay&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;p&amp;gt;Quo sed quis &amp;lt;a href="#"&amp;gt;fuga atque&amp;lt;/a&amp;gt; aliquid iste optio sunt voluptatum, laudantium enim dicta explicabo animi ipsa necessitatibus itaque hic ab rem dolor temporibus harum iure? Itaque minima quos architecto quia.
Velit soluta error, fugiat placeat deleniti tempore voluptatum consectetur repudiandae. Sit sed nihil numquam itaque facere labore earum neque, officia reiciendis non ea deserunt magnam tenetur! Magnam officiis vitae quidem?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x800" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Sunt dignissimos impedit corrupti aliquam adipisci quisquam est reprehenderit illum aspernatur alias, commodi neque ipsam eveniet odio amet nemo harum hic voluptatem optio quod culpa. Fugiat totam eaque excepturi amet.
  &amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;blockquote&amp;gt;Minus accusamus explicabo voluptatum at exercitationem aliquam aspernatur odit corrupti!&amp;lt;/blockquote&amp;gt;

&amp;lt;p&amp;gt;Velit ipsum eum quos? Voluptatum, quidem veniam repellat rerum impedit ducimus! &amp;lt;b&amp;gt;Provident perferendis&amp;lt;/b&amp;gt;, nostrum dolorum nesciunt earum amet dicta repellat ad vitae, laudantium iste assumenda fuga mollitia nobis, consequatur adipisci?&amp;lt;/p&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;
&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt;
  &amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Velit ipsum eum quos? Voluptatum, quidem veniam repellat rerum impedit ducimus! &amp;lt;b&amp;gt;Provident perferendis&amp;lt;/b&amp;gt;, nostrum dolorum nesciunt earum amet dicta repellat ad vitae, laudantium iste assumenda fuga mollitia nobis, consequatur adipisci?&amp;lt;/p&amp;gt;

&amp;lt;iframe src="https://css-tricks.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/650" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/400" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/350" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/700" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/600" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/550" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x600" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Choose your travel partners wisely&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/670" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/600" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/300" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/301" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/302" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x910" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x940" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;


&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;  

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/650" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/680" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/690" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;


&amp;lt;p&amp;gt;Perferendis accusamus asperiores nihil repudiandae, dignissimos sint natus, cumque consectetur maxime ducimus voluptates, nesciunt repellat! Rerum in totam voluptatibus quidem numquam perspiciatis fugiat delectus laboriosam praesentium explicabo, officiis, magnam perferendis?&amp;lt;/p&amp;gt;

&amp;lt;blockquote&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Cum, nemo veritatis.&amp;lt;/blockquote&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Don't forget to take photos!&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;p&amp;gt;Corporis deleniti consequuntur corrupti dolor sit tempora assumenda, quia quos modi aliquam, ex exercitationem asperiores est magni iste repellendus voluptatibus, alias maxime? Amet nostrum voluptates nam odio eius reprehenderit accusantium!&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/530" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/535" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x950" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x600" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit. &amp;lt;a href="#"&amp;gt;Doloremque&amp;lt;/a&amp;gt;, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;iframe src="https://smashingmagazine.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x900" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/450" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/450" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/450" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Hello World&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;
&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt;
  &amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Velit ipsum eum quos? Voluptatum, quidem veniam repellat rerum impedit ducimus! &amp;lt;b&amp;gt;Provident perferendis&amp;lt;/b&amp;gt;, nostrum dolorum nesciunt earum amet dicta repellat ad vitae, laudantium iste assumenda fuga mollitia nobis, consequatur adipisci?&amp;lt;/p&amp;gt;

&amp;lt;iframe src="https://css-tricks.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/650" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/400" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/350" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/700" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/600" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/550" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/621" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/620" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Travel Together&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/611" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/609" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/610" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1620x910" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1610x940" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1240x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/689" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/681" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/691" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;


&amp;lt;p&amp;gt;Perferendis accusamus asperiores nihil repudiandae, dignissimos sint natus, cumque consectetur maxime ducimus voluptates, nesciunt repellat! Rerum in totam voluptatibus quidem numquam perspiciatis fugiat delectus laboriosam praesentium explicabo, officiis, magnam perferendis?&amp;lt;/p&amp;gt;

&amp;lt;blockquote&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Cum, nemo veritatis.&amp;lt;/blockquote&amp;gt;

&amp;lt;p&amp;gt;Corporis deleniti consequuntur corrupti dolor sit tempora assumenda, quia quos modi aliquam, ex exercitationem asperiores est magni iste repellendus voluptatibus, alias maxime? Amet nostrum voluptates nam odio eius reprehenderit accusantium!&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/603" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/604" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1602x950" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1234x640" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit. &amp;lt;a href="#"&amp;gt;Doloremque&amp;lt;/a&amp;gt;, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Fruit and Food for the Road&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;iframe src="https://smashingmagazine.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1601x900" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/452" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/453" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/451" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;/article&amp;gt;

&amp;lt;footer&amp;gt;
  Footer. Thank you!
&amp;lt;/footer&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;html {
  font-size: 20px;
}

.off-screen {
  content-visibility: auto;
  contain-intrinsic-size: 100px 1000px;
}

body {
  background: #fdfbf5;
  margin: 0 auto;
  padding: 0 2rem;
  font-family: 'system-ui', sans-serif;
  box-sizing: border-box;
  max-width: 1000px;
  line-height: 1.4;
}

blockquote {
  padding: 2rem;
  border:  3px double hotpink;
}

p {
  max-width: 52ch;
}

h1 {
  text-align: center;
  font-size: 2.75rem;
}

a {
  color: mediumvioletred;
}

ul {
  list-style: none;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav ul {
  list-style: none;
}

figure {
  width: 100%;
  margin: 0;
}

img {
  width: 100%;
}

ul {
  list-style: circle;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.grid-2 figcaption {
  float: none;
  margin: -1rem auto 1rem;
}

.leading {
  font-size: 120%;
}

.leading::first-letter {
  font-size: 150%;
  font-weight: 800;
}

.hero {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.hero figcaption {
  margin: -1rem auto 0;
}

figcaption {
  font-size: 80%;
  background: mistyrose;
  padding: 1rem;
  margin: -1rem 0 1rem -1rem;
  z-index: 1;
  position: relative;
  width: 80%;
  max-width: 400px;
}

figure + figure figcaption {
  float: right;
  margin: -1rem -1rem 1rem 0;
}

figure img:not(.hero) {
  background: pink;
}

footer {
  font-style: italic;
  text-align: center;
  padding: 3rem;
  color: gray;
}

.p-group-flex {
  display: flex;
}

.p-group-flex p {
  margin: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Website --&amp;gt;
&amp;lt;nav&amp;gt;
  &amp;lt;a href="#"&amp;gt;My Travel Site&amp;lt;/a&amp;gt;
  &amp;lt;ul class="grid-3"&amp;gt;
    &amp;lt;li&amp;gt;Home&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;About&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;Archive&amp;lt;/li&amp;gt;
  &amp;lt;/ul&amp;gt;
&amp;lt;/nav&amp;gt;
&amp;lt;article&amp;gt;
  &amp;lt;h1&amp;gt;The Ultimate Weekend Road Trip Guide&amp;lt;/h1&amp;gt;

&amp;lt;figure class="hero"&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/1600x980" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;This Demo Uses Images from the &amp;lt;a href="https://unsplash.com"&amp;gt;Unsplash&amp;lt;/a&amp;gt; API.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p class="leading"&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;blockquote&amp;gt;Harum quo &amp;lt;i&amp;gt;distinctio facilis&amp;lt;/i&amp;gt; dolorem. Consectetur iste repellendus impedit&amp;lt;/blockquote&amp;gt;

&amp;lt;p&amp;gt;Harum quo distinctio facilis dolorem. Consectetur iste repellendus impedit, odio, corrupti aliquid officia molestiae hic mollitia, omnis aperiam quos enim alias doloribus sint libero ipsa numquam reprehenderit laudantium voluptatibus voluptates!&amp;lt;/p

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x920" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;h2&amp;gt;Make sure you're stocked up on snacks&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/410" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/411" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/430" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. &amp;lt;i&amp;gt;Sint, qui doloremque sit voluptate quis voluptatum&amp;lt;/i&amp;gt;, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;iframe src="https://codepen.io" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;p&amp;gt;Ex provident eos expedita odio quas, et rem nemo voluptatibus necessitatibus ab, voluptatum nam nesciunt impedit sint repellendus, dolorem cumque vero! Ipsa minus perspiciatis dolores! Magnam assumenda quidem itaque totam?&amp;lt;/p&amp;gt;

&amp;lt;ul&amp;gt;
  &amp;lt;li&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit.&amp;lt;/li&amp;gt;
  &amp;lt;li&amp;gt;Aut expedita magni, provident tenetur non voluptatem culpa nesciunt deleniti dolor amet ducimus a quis veniam nisi odit ex cupiditate sunt.&amp;lt;/li&amp;gt;
  &amp;lt;li&amp;gt;Fugit illo illum sapiente neque id soluta sunt error harum nulla qui blanditiis, nemo perspiciatis nesciunt, voluptate voluptates excepturi ipsa sequi vero vitae.&amp;lt;/li&amp;gt;
  &amp;lt;li&amp;gt;Debitis aperiam ipsa hic quibusdam animi ipsum.&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;

&amp;lt;p&amp;gt;&amp;lt;a href="#"&amp;gt;Atque similique&amp;lt;/a&amp;gt; quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/620" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/610" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/800x400" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, &amp;lt;a href="#"&amp;gt;doloremque debitis&amp;lt;/a&amp;gt; deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x900"&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quam modi tempora perferendis. Repellendus, facere accusamus. Distinctio, sit! Cupiditate voluptatibus at id eos nulla consequuntur, dicta animi aut, reiciendis minus hic?&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Don't forget to plan your stay&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;p&amp;gt;Quo sed quis &amp;lt;a href="#"&amp;gt;fuga atque&amp;lt;/a&amp;gt; aliquid iste optio sunt voluptatum, laudantium enim dicta explicabo animi ipsa necessitatibus itaque hic ab rem dolor temporibus harum iure? Itaque minima quos architecto quia.
Velit soluta error, fugiat placeat deleniti tempore voluptatum consectetur repudiandae. Sit sed nihil numquam itaque facere labore earum neque, officia reiciendis non ea deserunt magnam tenetur! Magnam officiis vitae quidem?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x800" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Sunt dignissimos impedit corrupti aliquam adipisci quisquam est reprehenderit illum aspernatur alias, commodi neque ipsam eveniet odio amet nemo harum hic voluptatem optio quod culpa. Fugiat totam eaque excepturi amet.
  &amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;blockquote&amp;gt;Minus accusamus explicabo voluptatum at exercitationem aliquam aspernatur odit corrupti!&amp;lt;/blockquote&amp;gt;

&amp;lt;p&amp;gt;Velit ipsum eum quos? Voluptatum, quidem veniam repellat rerum impedit ducimus! &amp;lt;b&amp;gt;Provident perferendis&amp;lt;/b&amp;gt;, nostrum dolorum nesciunt earum amet dicta repellat ad vitae, laudantium iste assumenda fuga mollitia nobis, consequatur adipisci?&amp;lt;/p&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;
&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt;
  &amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Velit ipsum eum quos? Voluptatum, quidem veniam repellat rerum impedit ducimus! &amp;lt;b&amp;gt;Provident perferendis&amp;lt;/b&amp;gt;, nostrum dolorum nesciunt earum amet dicta repellat ad vitae, laudantium iste assumenda fuga mollitia nobis, consequatur adipisci?&amp;lt;/p&amp;gt;

&amp;lt;iframe src="https://css-tricks.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/650" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/400" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/350" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/700" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/600" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/550" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x600" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Choose your travel partners wisely&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/670" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/600" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/300" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/301" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/302" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x910" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x940" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;


&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;  

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/650" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/680" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/690" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;


&amp;lt;p&amp;gt;Perferendis accusamus asperiores nihil repudiandae, dignissimos sint natus, cumque consectetur maxime ducimus voluptates, nesciunt repellat! Rerum in totam voluptatibus quidem numquam perspiciatis fugiat delectus laboriosam praesentium explicabo, officiis, magnam perferendis?&amp;lt;/p&amp;gt;

&amp;lt;blockquote&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Cum, nemo veritatis.&amp;lt;/blockquote&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Don't forget to take photos!&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;p&amp;gt;Corporis deleniti consequuntur corrupti dolor sit tempora assumenda, quia quos modi aliquam, ex exercitationem asperiores est magni iste repellendus voluptatibus, alias maxime? Amet nostrum voluptates nam odio eius reprehenderit accusantium!&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/530" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/535" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x950" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x600" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit. &amp;lt;a href="#"&amp;gt;Doloremque&amp;lt;/a&amp;gt;, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;iframe src="https://smashingmagazine.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1600x900" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/450" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/450" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/450" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Hello World&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;
&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt;
  &amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Velit ipsum eum quos? Voluptatum, quidem veniam repellat rerum impedit ducimus! &amp;lt;b&amp;gt;Provident perferendis&amp;lt;/b&amp;gt;, nostrum dolorum nesciunt earum amet dicta repellat ad vitae, laudantium iste assumenda fuga mollitia nobis, consequatur adipisci?&amp;lt;/p&amp;gt;

&amp;lt;iframe src="https://css-tricks.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/650" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/400" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/350" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/700" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/600" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/550" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1200x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Atque similique quia eos cupiditate, repellat quibusdam rerum, facilis quisquam eius beatae omnis excepturi. Sint, qui doloremque sit voluptate quis voluptatum, distinctio sunt eaque voluptas placeat praesentium amet error nostrum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/621" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/620" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Travel Together&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/611" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/609" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/610" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1620x910" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1610x940" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Perspiciatis modi reprehenderit quisquam suscipit ipsum totam labore, voluptatibus illum adipisci inventore quos dolorum velit!&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1240x700" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/689" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/681" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/691" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;


&amp;lt;p&amp;gt;Perferendis accusamus asperiores nihil repudiandae, dignissimos sint natus, cumque consectetur maxime ducimus voluptates, nesciunt repellat! Rerum in totam voluptatibus quidem numquam perspiciatis fugiat delectus laboriosam praesentium explicabo, officiis, magnam perferendis?&amp;lt;/p&amp;gt;

&amp;lt;blockquote&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Cum, nemo veritatis.&amp;lt;/blockquote&amp;gt;

&amp;lt;p&amp;gt;Corporis deleniti consequuntur corrupti dolor sit tempora assumenda, quia quos modi aliquam, ex exercitationem asperiores est magni iste repellendus voluptatibus, alias maxime? Amet nostrum voluptates nam odio eius reprehenderit accusantium!&amp;lt;/p&amp;gt;

&amp;lt;div class="grid-2"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/603" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/604" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Facilis nesciunt perferendis porro incidunt, doloremque debitis deleniti blanditiis eum ab fuga magnam asperiores provident.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="p-group-flex"&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae. Temporibus, eum!&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1602x950" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1234x640" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit. &amp;lt;a href="#"&amp;gt;Doloremque&amp;lt;/a&amp;gt;, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;/div&amp;gt;
&amp;lt;h2&amp;gt;Fruit and Food for the Road&amp;lt;/h2&amp;gt;
&amp;lt;div class="off-screen"&amp;gt;

&amp;lt;iframe src="https://smashingmagazine.com" style="width: 100%; height: 500px" frameborder="0"&amp;gt;&amp;lt;/iframe&amp;gt;

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/1601x900" alt=""&amp;gt;
  &amp;lt;figcaption&amp;gt;&amp;lt;a href="#"&amp;gt;Lorem ipsum&amp;lt;/a&amp;gt; dolor sit amet consectetur, adipisicing elit. Doloremque, praesentium.&amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

&amp;lt;div class="grid-3"&amp;gt;
  &amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/452" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/453" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;figure&amp;gt;
  &amp;lt;img src="https://source.unsplash.com/random/451" alt=""&amp;gt;
&amp;lt;/figure&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;Recusandae, eveniet? Pariatur voluptatibus voluptatem ad aut iusto rem officia eum, repudiandae facere ratione ipsum id cumque molestias placeat laboriosam quis iure excepturi suscipit quia maiores, provident beatae.&amp;lt;/p&amp;gt; 

&amp;lt;p&amp;gt;Lorem ipsum dolor, sit amet consectetur adipisicing elit. Asperiores placeat corrupti vel harum. Omnis inventore, eum quo obcaecati at iusto voluptate explicabo soluta, nisi quisquam asperiores ratione, possimus ea totam?&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&amp;lt;/article&amp;gt;

&amp;lt;footer&amp;gt;
  Footer. Thank you!
&amp;lt;/footer&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This CSS &lt;em&gt;content-visibility&lt;/em&gt; property is very useful for improving the performance of blog pages, news articles, or any webpage that is long and has a lot of images and content.&lt;/p&gt;

&lt;p&gt;When we use CSS &lt;em&gt;content-visibility: auto&lt;/em&gt;, a large portion of our webpage is not rendered. Hence the browser considers the webpage to be smaller than the actual length. This makes a snappy scrollbar effect where the scrollbar adjusts the position every time we scroll down. Because as we scroll down, new content is rendered, and hence the length is recalculated.&lt;/p&gt;

&lt;p&gt;This problem can be easily solved using the &lt;em&gt;contain-intrinsic-size&lt;/em&gt; property.&lt;/p&gt;

&lt;h3&gt;
  
  
  The ‘contain-intrinsic-size’ property
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;contain-intrinsic-size&lt;/em&gt; property is a CSS shorthand property for the &lt;em&gt;contain-intrinsic-width&lt;/em&gt; and &lt;em&gt;contain-intrinsic-height&lt;/em&gt; properties. This property applies size containment to the element. In simple words, this property is used to provide the estimated size for the elements that the browser has not rendered yet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* contain-intrinsic-size: width height; */


.container {
    contain-intrinsic-size: 100px 1000px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;contain-intrinsic-size&lt;/em&gt; property is combined with &lt;em&gt;CSS content-visibility&lt;/em&gt; to provide a fallback size for all the elements whose render phase is skipped. Hence the browser knows the length of the web page, and hence the scrollbar does not reposition itself when we scroll down.&lt;/p&gt;

&lt;p&gt;For our example, we will give a rough estimate of 100px width and 1000px height for all the off-screen elements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.off-screen {
    content-visibility: auto;
    contain-intrinsic-size: 100px 1000px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Browser Support
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;content-visibility&lt;/em&gt; property was added in Chromium 85 and is currently available in all the latest Chrome, Edge, and Opera versions. This property is still in the consideration stage for Firefox and Safari.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1-pAsyvX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABc2ljnaI03DItRx_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1-pAsyvX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ABc2ljnaI03DItRx_.png" alt="image" width="800" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So if you plan to use ‘&lt;em&gt;content-visibility: hidden&lt;/em&gt;’ in the production website, don’t forget to use feature detection and combine it with the ‘&lt;em&gt;display: hidden&lt;/em&gt;’ property. On the other hand, ‘&lt;em&gt;content-visibility: auto&lt;/em&gt;’ enhances the performance of your website and has no negative impact if the browser does not support it. Hence you can use this property without worrying about its support.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3IjpRqdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AZZpROT48E8DqkZUI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3IjpRqdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AZZpROT48E8DqkZUI.png" alt="image" width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ‘contain-intrinsic-size’ property supports newer versions of Chrome, Edge, Firefox, and Opera. It is still in the preview phase on Safari Browser.&lt;/p&gt;

&lt;p&gt;To test your website or web app’s working or functionality on different browsers, LambdaTest is a unified intelligent &lt;a href="https://www.lambdatest.com/blog/digital-experience-testing-guide/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;digital experience testing&lt;/a&gt; platform that allows developers and testers to perform &lt;a href="https://www.lambdatest.com/learning-hub/cross-browser-compatibility?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;cross browser compatibility testing&lt;/a&gt; over more than 3000+ different browsers and OS combinations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Run your&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;&lt;strong&gt;&lt;em&gt;Selenium Automation Testing&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;scripts on the LambdaTest cloud grid. Test on 3000+ desktop &amp;amp; mobile environments. Try it for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, LambdaTest also provides powerful features, such as &lt;a href="https://www.lambdatest.com/automated-screenshot?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;automated screenshot testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/visual-regression-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;visual regression testing&lt;/a&gt;, and &lt;a href="https://www.lambdatest.com/geolocation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;geolocation testing&lt;/a&gt;. These features allow developers to test their websites in different scenarios and identify any issues that may impact browser compatibility.&lt;/p&gt;

&lt;p&gt;To get started with LambdaTest, you just need to follow these simple steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.lambdatest.com/register?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Register for free&lt;/a&gt; and sign in to your LambdaTest account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose a &lt;strong&gt;Realtime Testing&lt;/strong&gt; card from the modal box.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter the test URL, choose your preferred browser’s version, OS, and resolution, and select either web or mobile tab. Then click &lt;strong&gt;START&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z-l3X6tJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A9ZdhvDy-1UqBqp6q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z-l3X6tJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A9ZdhvDy-1UqBqp6q.png" alt="image" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will launch a cloud-based machine that runs on the operating system and real browsers. Now, you can test your website by leveraging powerful features like one-click bug logging, video recording, different network conditions, and others.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3vJQv4OD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATST-iEHYqbrxV66X.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3vJQv4OD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATST-iEHYqbrxV66X.png" alt="image" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Refer to the below video to get started with real-time testing on LambdaTest.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/WYbyLfLM2-E"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You can also subscribe to our &lt;a href="https://www.youtube.com/c/LambdaTest?sub_confirmation=1?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=youtube"&gt;LambdaTest YouTube Channel&lt;/a&gt; to stay up-to-date on software testing topics around &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Selenium testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/cypress-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Cypress testing&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/playwright?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=apr25_ap&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Playwright&lt;/a&gt;, and more.&lt;/p&gt;

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

&lt;p&gt;It’s almost magic how one single line of CSS code can make such a huge impact on a website’s performance. If you want to make your website more performant, don’t miss out on the CSS &lt;em&gt;content-visibility&lt;/em&gt; property.&lt;/p&gt;

&lt;p&gt;In this blog, we understand why website performance is important. We checked the new CSS &lt;em&gt;content-visibility&lt;/em&gt; property and its values and saw how by using this property, we can boost our website performance. We then applied the property to an existing blog page and brought the rendering time down by 80%. I hope you found it helpful.&lt;/p&gt;

</description>
      <category>csscontent</category>
      <category>visibility</category>
      <category>webpage</category>
      <category>automationtesting</category>
    </item>
  </channel>
</rss>
