<?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: SatyamTripathi</title>
    <description>The latest articles on DEV Community by SatyamTripathi (@satyamtripathi651).</description>
    <link>https://dev.to/satyamtripathi651</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%2F1180442%2F29f6ef33-f4df-4fec-8536-259d30acab83.png</url>
      <title>DEV Community: SatyamTripathi</title>
      <link>https://dev.to/satyamtripathi651</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/satyamtripathi651"/>
    <language>en</language>
    <item>
      <title>Bulma CSS Framework: Getting Started Guide</title>
      <dc:creator>SatyamTripathi</dc:creator>
      <pubDate>Tue, 10 Oct 2023 07:51:53 +0000</pubDate>
      <link>https://dev.to/satyamtripathi651/bulma-css-framework-getting-started-guide-17hk</link>
      <guid>https://dev.to/satyamtripathi651/bulma-css-framework-getting-started-guide-17hk</guid>
      <description>&lt;p&gt;An interactive and responsive website provides a better user experience on all browsers, devices, and operating systems, engaging users and encouraging them to spend more time on the site.&lt;/p&gt;

&lt;p&gt;According to a report by Forbes, usеrs judgе wеbsitеs within a mеrе 0.05 sеconds. This highlights the crucial role of impactful wеb dеsign. A wеll-dеsignеd, usеr-friеndly wеbsitе has thе powеr to captivatе visitors, rеtain thеir attеntion, and еvеn convеrt thеm into customеrs.&lt;/p&gt;

&lt;p&gt;When users can access all of the website’s features on any device without any issues, such websites are more likely to rank higher in search results, which can increase traffic to the website. Key KPIs like average time spent on a page, bounce rate, sessions, conversion rate, etc., are all interconnected with the website experience. The better the web experience, the higher the time spent on the site, which might lead to increased conversions.&lt;/p&gt;

&lt;p&gt;The web experience can be better if developers can import only what they need, developers can style the web pages without writing a single line of JavaScript code, and a lot more. This all can be done by using the Bulma CSS framework.&lt;/p&gt;

&lt;p&gt;In this blog, we will dive deep into the Bulma CSS framework and explore how to use Bulma in your project. The learnings from this blog will further help you build a feature-rich website or mobile application with minimal effort.&lt;/p&gt;

&lt;p&gt;Without further ado, let’s get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Looking for a tool to generate random text? Use our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-character-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Random Character Generator&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;to generate random characters for all your purposes. Try it out today.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;Bulma is a free, open-source, and &lt;a href="https://www.lambdatest.com/blog/responsive-lightweight-css-frameworks/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;lightweight CSS framework&lt;/a&gt; based on the &lt;a href="https://www.lambdatest.com/blog/css-flexbox-tutorial/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Flexbox&lt;/a&gt; layout. It provides CSS classes to help you style your HTML code, allowing developers to implement CSS on web pages more efficiently than plain CSS.&lt;/p&gt;

&lt;p&gt;The main advantage of using Bulma CSS is that it is built on the Flexbox layout. This CSS layout model automatically adjusts the width of a page element to best fill the available space based on the width of its container without using many float and position properties in the CSS code.&lt;/p&gt;

&lt;p&gt;Bulma is open-source, and the project is hosted on GitHub. It is compatible with recent versions of Chrome, Edge, Firefox, Opera, and Safari, but Internet Explorer (10+) is only partially supported. Bulma uses Autoprefixer to make Flexbox features compatible with earlier browser versions.&lt;/p&gt;

&lt;p&gt;Shown below is the browser compatibility of the Bulma framework. This indicates that users can get a uniform web experience when it is opened across different browsers (and browser versions).&lt;/p&gt;

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

&lt;p&gt;The below graph shows the distribution of organizations using Bulma. The computer software company is at the top, followed by IT and services. The hospital and healthcare industry use Bulma in very fewer numbers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tJ0obOtL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Akp5PGBoXggrY4Pny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tJ0obOtL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2Akp5PGBoXggrY4Pny.png" alt="image" width="800" height="365"&gt;&lt;/a&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=oct_10&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;
  
  
  Features of Bulma CSS Framework
&lt;/h3&gt;

&lt;p&gt;Bulma CSS framework has a lot of features, such as responsiveness (elements can adjust to fit any viewport size). This framework is modular, which means you can import only what you need. You can style the webpage without writing a single line of JavaScript code. Also, the Bulma framework supports a massive library of interactive elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Responsiveness
&lt;/h3&gt;

&lt;p&gt;Bulma CSS Framework is a mobile-first CSS framework that lets you build a &lt;a href="https://www.lambdatest.com/learning-hub/responsive-design?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive design&lt;/a&gt; for mobile, tablet, desktop, etc. Its built-in components are designed to be responsive, which means elements will move and adjust to fit any screen or viewport size.&lt;/p&gt;

&lt;p&gt;The columns in Bulma are stacked on top of each other, and the navigation menu is hidden. The children of the level component are also stacked vertically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Platforms&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns "&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Platform&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;


    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-primary-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Playwright Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Playwright scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;


          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-info-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Selenium Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Selenium scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;


          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-danger-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Cypress Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Cypress scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the image below, columns are stacked on top of each other.&lt;/p&gt;

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

&lt;p&gt;Columns are adjusted according to the change in the device, as shown below.&lt;/p&gt;

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

&lt;p&gt;The above output has been rendered on LT Browser 2.0, a complimentary tool by the LambdaTest platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need random dates? Our online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-date-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Random Date Generator&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;tool generates random dates for your projects. Choose a start and end date, and let our tool do the rest.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/support/docs/lt-browser?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=support_doc"&gt;LT Browsеr 2.0&lt;/a&gt; is a dеv-friеndly browsеr dеsignеd spеcifically for building, tеsting, and dеbugging mobilе wеbsitеs. It lеts you tеst wеbsitе pеrformancе on various mobilе dеvicе viеwports. Morеovеr, you can еvеn customizе thе viewport rеsolution to tеst your wеbsitеs, saving thеsе sеttings for futurе rеfеrеncе.&lt;/p&gt;

&lt;p&gt;With LT Browsеr 2.0, you can еxplorе and assеss your wеbsitеs on a widе rangе of scrееn rеsolutions, including dеsktops, mobilеs, tablеts, and laptops. To get started, check our &lt;a href="https://www.lambdatest.com/support/docs/lt-browser-2/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=support_doc"&gt;documentation on LT Browser 2.0&lt;/a&gt;&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 the &lt;a href="https://www.youtube.com/c/LambdaTest?sub_confirmation=1"&gt;LambdaTest YouTube Channel&lt;/a&gt; and stay up to date with the latest tutorials around &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&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=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Cypress testing&lt;/a&gt;, and more.&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&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Platforms&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns "&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Platform&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-primary-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Playwright Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Playwright scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-info-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Selenium Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Selenium scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-danger-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Cypress Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Cypress scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;Above, we have seen that as the viewport size changes, the arrangement of columns has also changed, for the mobile device viewports, the columns were stacked on top of each other, but for the desktop, the columns became horizontal.&lt;/p&gt;

&lt;p&gt;To achiеvе a horizontal layout for columns or lеvеl componеnts that works consistently across all viеwport sizеs, you can utilizе thе &lt;em&gt;is-mobilе&lt;/em&gt; modifiеr.&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="columns is-centered is-mobile"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As shown in the image below, the horizontal layout is the same across all the viewport sizes. This happens because we use the &lt;em&gt;is-mobile&lt;/em&gt; modifier. The is-mobile modifier can be used to make the website looks good and easy to use on mobile device viewports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before *is-mobile:&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;The columns are stacked on top of each other when we are not using the &lt;em&gt;is-mobile&lt;/em&gt; modifier.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;After *is-mobile:&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tvdx52fa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AeVxO6G7oau0o_x1M.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tvdx52fa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AeVxO6G7oau0o_x1M.png" alt="image" width="577" height="808"&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Platforms&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns "&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Platform&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered is-mobile"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-primary-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Playwright Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Playwright scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-info-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Selenium Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Selenium scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card has-background-danger-dark"&amp;gt;
              &amp;lt;div class="card-content has-text-white"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4 has-text-white"&amp;gt;Cypress Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5 has-text-white"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Cypress scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;h3&gt;
  
  
  Modularity
&lt;/h3&gt;

&lt;p&gt;Bulma CSS framework is fully modular, where you can import only what you need. Bulma consists of 39 &lt;em&gt;.sass&lt;/em&gt; files that you can import individually. These files are located in the &lt;em&gt;bulma/sass/grid&lt;/em&gt; folder.&lt;/p&gt;

&lt;p&gt;Some of the .saas files are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;FILE NAME&lt;/td&gt;
        &lt;td&gt;DESCRIPTION &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;button.sass&lt;/td&gt;
        &lt;td&gt;To import the button style &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;card.sass&lt;/td&gt;
        &lt;td&gt;To import the card style &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;checkbox.sass&lt;/td&gt;
        &lt;td&gt;To import the checkbox &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;columns.sass&lt;/td&gt;
        &lt;td&gt;To import the columns &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;container.sass&lt;/td&gt;
        &lt;td&gt;To import the containers&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;/td&gt;
        &lt;td&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When you import the specific file needed for your project, the amount of code will be reduced in the CSS file. This will enable the web page to load faster, improving both load times and render time. So, if the web page loads faster, this will enhance the user experience, and the chances of conversion will be increased.&lt;/p&gt;

&lt;p&gt;For example, if you only want to use the button styles in your project, you can import the button styles directly from the Bulma framework by adding the following line to your own Sass or SCSS file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import "bulma/sass/utilities/_all.sass"
@import "bulma/sass/elements/button.sass"
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;&lt;em&gt;Need decimal fractions for your project or testing? Use our free and fast online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-decimal-fraction-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Random Fraction Generator&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;to generate random decimal fractions in seconds.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  No JavaScript
&lt;/h3&gt;

&lt;p&gt;You can use Bulma to style your web pages without writing a single line of JavaScript code. This makes Bulma a lightweight and easy-to-use CSS framework, especially for developers who prefer to focus more on styling than complex scripting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Platforms&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Platform&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;


    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Playwright Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Playwright scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;


          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Selenium Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Selenium scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;


          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Cypress Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Cypress scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;Output:&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;As shown below, the layout is fully responsive and adapts to different screen sizes without requiring any JavaScript code.&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&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Platforms&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Platform&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Playwright Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Playwright scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Selenium Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Selenium scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Cypress Testing&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Run Cypress scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;h3&gt;
  
  
  Massive Library of Interactive Elements
&lt;/h3&gt;

&lt;p&gt;Bulma provides many customizable components to create and customize website layouts and styles quickly. You don’t have to write complex CSS from scratch; instead, you can use predefined classes and components to achieve the desired look and functionality.&lt;/p&gt;

&lt;p&gt;Bulma also provides helper classes to create more complex layouts and styles. For example, let’s say you have a &lt;em&gt;div&lt;/em&gt; element in your HTML file and want to apply custom styling. You can use the helper classes to modify the margin, padding, background color, etc., of the div element.&lt;/p&gt;

&lt;p&gt;Helper classes in Bulma CSS provide convenient options to style elements without having to write custom CSS rules. Below are some helper classes we are using:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;HELPER CLASSES&lt;/td&gt;
        &lt;td&gt;DESCRIPTION &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;has-text-centered&lt;/td&gt;
        &lt;td&gt;Center text inside the div in the horizontal direction. &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;has-background-info&lt;/td&gt;
        &lt;td&gt;Set the background color of the div to a light green color. &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;p-5&lt;/td&gt;
        &lt;td&gt;Add a padding of size 5 to all sides of the div. &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;m-5&lt;/td&gt;
        &lt;td&gt;Add a margin of size 5 to all sides of the div. &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;title is-4&lt;/td&gt;
        &lt;td&gt;Title of heading 4. &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;subtitle-is-5&lt;/td&gt;
        &lt;td&gt;Subtitle of heading 5.&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;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;div class="column is-one-third"&amp;gt;
  &amp;lt;div class="card has-text-centered has-background-primary m-5 p-3"&amp;gt;
    &amp;lt;div class="card-content"&amp;gt;
      &amp;lt;div class="content"&amp;gt;
        &amp;lt;h4 class="title is-4"&amp;gt;Playwright Testing&amp;lt;/h4&amp;gt;
        &amp;lt;p class="subtitle is-5"&amp;gt;View Documentation&amp;lt;/p&amp;gt;
        &amp;lt;p&amp;gt;Run Playwright scripts on cloud-based infrastructure.&amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&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;&lt;em&gt;Need accurate decimal values? Look no further! Our generator can create&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-decimal-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;random decimals&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with just a few clicks. Try it out now and see for yourself.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started with Bulma CSS
&lt;/h3&gt;

&lt;p&gt;To use Bulma in your project, you must first set it up. Setting up Bulma is super easy. You can do a setup in several ways. You can use a CDN, install the NPM package, download the GitHub release, and clone the GitHub repository.&lt;/p&gt;

&lt;p&gt;To use a CDN, you can directly import it using the below code block. Include the code block below in the HTML file’s &amp;lt; head &amp;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;lt;link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"
    /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Bulma CSS&amp;lt;/title&amp;gt;


    &amp;lt;!--Bulma CDN--&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div class="container"&amp;gt;
      &amp;lt;h1 class="title"&amp;gt;Welcome to Bulma CSS&amp;lt;/h1&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;To install the NPM package, run the below command in your terminal.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Now download the GitHub release of Bulma.&lt;/p&gt;

&lt;p&gt;To clone the Bulma GitHub Repository, run the below command in your terminal, and then include the “bulma/css/bulma.css” in the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/jgthms/bulma.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Exploring Bulma’s Components and Layouts
&lt;/h3&gt;

&lt;p&gt;Bulma uses HTML classes to style elements on a web page. It relies heavily on class-based syntax to simplify the process of applying styles to HTML elements. To style an element on a web page, simply add one or more classes inside the element’s HTML tag.&lt;/p&gt;

&lt;p&gt;Let’s take a look at some examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  Buttons
&lt;/h3&gt;

&lt;p&gt;To create a button using Bulma, simply add the “button” class to your HTML button element like this:&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="button"&amp;gt;Click me!&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By adding the button class in the HTML element, Bulma recognizes the button class and applies some basic styling.&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;a href="#" class="button"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;To enhance the style of your button, you can use Bulma modifiers. Bulma provides modifier classes that apply alternative styles to elements. The modifier class name starts with ‘is-‘ or ‘has-‘ followed by a style name.&lt;/p&gt;

&lt;p&gt;For example, let’s take a look at the is-&lt;em&gt;rounded&lt;/em&gt; modifier. This modifier gives your button a rounded appearance at the corners.&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;a href="#" class="button is-rounded"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;Modifiers can be used to adjust the colors and shading of your button. For example, ‘is-success’ will give your button a green appearance, ‘is-warning’ will give it a light yellow look, ‘is-danger’ will give it a red appearance, etc.&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;a href="#" class="button is-rounded is-danger"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button is-rounded is-warning"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button is-rounded is-success"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded is-danger"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded is-warning"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded is-success"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;Multiple modifier classes can be applied to the same element. For example, you can use the ‘is-outlined’ modifier to apply an outlined style to an element. The ‘is-outlined’ class removes the background color of the button and replaces it with an outline.&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;a href="#" class="button is-rounded is-danger is-outlined"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button is-rounded is-warning is-outlined"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button is-rounded is-success is-outlined"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded is-danger is-outlined"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded is-warning is-outlined"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-rounded is-success is-outlined"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;To change the text color of your button, you can use the ‘has’ modifier. For example, the ‘has-text-success’ modifier will make the text look green, ‘has-text-grey’ will make the text gray, and so on.&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;a href="#" class="button has-text-danger"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button has-text-warning"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button has-text-success"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button has-text-danger"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button has-text-warning"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button has-text-success"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;&lt;em&gt;Need a global unique identifier?&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-guid-generator?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Generate random GUIDs&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;quickly and easily with our free online Random GUID Generator tool in seconds. Get a new GUID every time.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To change the button’s background color, you can use the ‘has’ modifier. For example, ‘has-background-white’ will make the background white, ‘has-background-success’ will make the background green, and so on.&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;a href="#" class="button has-background-danger"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button has-background-warning"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button has-background-success"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button has-background-danger"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button has-background-warning"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button has-background-success"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;You can control the button size by using some modifiers such as ‘is-small’, ‘is-normal’, ‘is-large’, etc.&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;a href="#" class="button is-small"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button is-normal"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&amp;lt;a href="#" class="button is-medium"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;My Basic Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-small"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-normal"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-medium"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;You can transform the text by using modifiers such as ‘is-capitalized’, ‘is-lowercase’, ‘is-uppercase’, etc.&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&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Pricing Page&amp;lt;/title&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;!-- Header with logo and heading --&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Pricing&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;!-- Pricing plans --&amp;gt;
    &amp;lt;section class="section"&amp;gt;
      &amp;lt;div class="container"&amp;gt;
        &amp;lt;div class="columns is-centered"&amp;gt;
          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Basic&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$10/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic Features Only&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-uppercase"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Standard&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$20/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;Basic &amp;amp; Advanced Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-italic"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;

          &amp;lt;div class="column is-one-third"&amp;gt;
            &amp;lt;div class="card"&amp;gt;
              &amp;lt;div class="card-content"&amp;gt;
                &amp;lt;div class="content"&amp;gt;
                  &amp;lt;h4 class="title is-4"&amp;gt;Premium&amp;lt;/h4&amp;gt;
                  &amp;lt;p class="subtitle is-5"&amp;gt;$30/month&amp;lt;/p&amp;gt;
                  &amp;lt;p&amp;gt;All Premium Features&amp;lt;/p&amp;gt;
                  &amp;lt;a href="#" class="button is-underlined"&amp;gt;Sign Up&amp;lt;/a&amp;gt;
                &amp;lt;/div&amp;gt;
              &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&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;You can also change the text weight, font family, and so on by similarly using different modifiers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need to&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/random-data-from-regexp?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;generate random text&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;based on a regular expression for testing and generating sample data.? Use our online tool to create random text from RegEx.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Progress Bar
&lt;/h3&gt;

&lt;p&gt;To add a progress bar using Bulma, you can use the progress class on an &lt;em&gt;&amp;lt; progress &amp;gt;&lt;/em&gt; HTML element. The value attribute sets the current progress value, and the &lt;em&gt;max&lt;/em&gt; attribute sets the maximum progress value.&lt;/p&gt;

&lt;p&gt;You can use modifiers to add more effects to the progress bar, just like with buttons. For example, you can add “is-success” or “is-danger” to change the color of the progress bar. To create the motion effect, exclude the “value” attribute from the HTML element. To adjust the size of the progress bar, you can apply the modifiers “is-small”, “is-medium”, and so on.&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&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Bulma CSS&amp;lt;/title&amp;gt;

    &amp;lt;!--Bulma CDN--&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Task Status&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;
    &amp;lt;h3 class="subtitle is-4 has-text-warning-dark mt-3 ml-3"&amp;gt;
      Task deadline approaching 
    &amp;lt;/h3&amp;gt;
    &amp;lt;progress class="progress is-warning ml-3" value="30" max="100"&amp;gt;&amp;lt;/progress&amp;gt;
    &amp;lt;h3 class="subtitle is-4 has-text-danger mt-3 ml-3"&amp;gt;Error encountered!&amp;lt;/h3&amp;gt;
    &amp;lt;progress class="progress is-danger ml-3" value="40" max="100"&amp;gt;&amp;lt;/progress&amp;gt;
    &amp;lt;h3 class="subtitle is-4 has-text-info mt-3 ml-3"&amp;gt;Task in progress...&amp;lt;/h3&amp;gt;
    &amp;lt;progress class="progress is-info ml-3" max="100"&amp;gt;&amp;lt;/progress&amp;gt;
    &amp;lt;h3 class="subtitle is-4 has-text-success mt-3 ml-3"&amp;gt;
      Task successfully completed
    &amp;lt;/h3&amp;gt;
    &amp;lt;progress class="progress is-success ml-3" value="100" max="100"&amp;gt;&amp;lt;/progress&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  User Input
&lt;/h3&gt;

&lt;p&gt;Bulma provides a set of form control elements to collect user-inputted information. Some of these elements include text input, textarea, checkbox, radio buttons, and dropdown menus.&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;form class="ml-2"&amp;gt;
    &amp;lt;div class="field"&amp;gt;
      &amp;lt;label class="label"&amp;gt;Name&amp;lt;/label&amp;gt;
      &amp;lt;div class="control"&amp;gt;
        &amp;lt;input class="input is-success" type="text" placeholder="Enter your name"&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
        &amp;lt;div class="field"&amp;gt;
      &amp;lt;label class="label"&amp;gt;Email&amp;lt;/label&amp;gt;
      &amp;lt;div class="control"&amp;gt;
        &amp;lt;input class="input is-success" type="email" placeholder="Enter your email address"&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="field"&amp;gt;
      &amp;lt;label class="label"&amp;gt;Comments&amp;lt;/label&amp;gt;
      &amp;lt;div class="control"&amp;gt;
        &amp;lt;textarea class="textarea" placeholder="Enter your message"&amp;gt;&amp;lt;/textarea&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="field"&amp;gt;
      &amp;lt;label class="label"&amp;gt;Language&amp;lt;/label&amp;gt;
      &amp;lt;div class="control"&amp;gt;
        &amp;lt;div class="select"&amp;gt;
          &amp;lt;select&amp;gt;
            &amp;lt;option&amp;gt;Select language&amp;lt;/option&amp;gt;
            &amp;lt;option&amp;gt;Hindi&amp;lt;/option&amp;gt;
            &amp;lt;option&amp;gt;English&amp;lt;/option&amp;gt;
            &amp;lt;option&amp;gt;French&amp;lt;/option&amp;gt;
          &amp;lt;/select&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;div class="field"&amp;gt;
    &amp;lt;label class="label"&amp;gt;Gender&amp;lt;/label&amp;gt;
    &amp;lt;div class="control"&amp;gt;
      &amp;lt;label class="radio"&amp;gt;
        &amp;lt;input type="radio" name="gender" value="male"&amp;gt;
        Male
      &amp;lt;/label&amp;gt;
      &amp;lt;label class="radio"&amp;gt;
        &amp;lt;input type="radio" name="gender" value="female"&amp;gt;
        Female
      &amp;lt;/label&amp;gt;
      &amp;lt;label class="radio"&amp;gt;
        &amp;lt;input type="radio" name="gender" value="other"&amp;gt;
        Other
      &amp;lt;/label&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

    &amp;lt;div class="field"&amp;gt;
      &amp;lt;div class="control"&amp;gt;
        &amp;lt;label class="checkbox"&amp;gt;
          &amp;lt;input type="checkbox"&amp;gt;
           I agree to the terms and conditions.
        &amp;lt;/label&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="field"&amp;gt;
      &amp;lt;div class="control"&amp;gt;
        &amp;lt;button class="button is-success"&amp;gt;Submit&amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/form&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Bulma CSS&amp;lt;/title&amp;gt;

    &amp;lt;!--Bulma CDN--&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Create LambdaTest Account&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;
    &amp;lt;form class="ml-2"&amp;gt;
  &amp;lt;div class="field"&amp;gt;
    &amp;lt;label class="label"&amp;gt;Name&amp;lt;/label&amp;gt;
    &amp;lt;div class="control"&amp;gt;
      &amp;lt;input class="input is-success" type="text" placeholder="Enter your name"&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
      &amp;lt;div class="field"&amp;gt;
    &amp;lt;label class="label"&amp;gt;Email&amp;lt;/label&amp;gt;
    &amp;lt;div class="control"&amp;gt;
      &amp;lt;input class="input is-success" type="email" placeholder="Enter your email address"&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="field"&amp;gt;
    &amp;lt;label class="label"&amp;gt;Comments&amp;lt;/label&amp;gt;
    &amp;lt;div class="control"&amp;gt;
      &amp;lt;textarea class="textarea" placeholder="Enter your message"&amp;gt;&amp;lt;/textarea&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="field"&amp;gt;
    &amp;lt;label class="label"&amp;gt;Language&amp;lt;/label&amp;gt;
    &amp;lt;div class="control"&amp;gt;
      &amp;lt;div class="select"&amp;gt;
        &amp;lt;select&amp;gt;
          &amp;lt;option&amp;gt;Select language&amp;lt;/option&amp;gt;
          &amp;lt;option&amp;gt;Hindi&amp;lt;/option&amp;gt;
          &amp;lt;option&amp;gt;English&amp;lt;/option&amp;gt;
          &amp;lt;option&amp;gt;French&amp;lt;/option&amp;gt;
        &amp;lt;/select&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;div class="field"&amp;gt;
  &amp;lt;label class="label"&amp;gt;Gender&amp;lt;/label&amp;gt;
  &amp;lt;div class="control"&amp;gt;
    &amp;lt;label class="radio"&amp;gt;
      &amp;lt;input type="radio" name="gender" value="male"&amp;gt;
      Male
    &amp;lt;/label&amp;gt;
    &amp;lt;label class="radio"&amp;gt;
      &amp;lt;input type="radio" name="gender" value="female"&amp;gt;
      Female
    &amp;lt;/label&amp;gt;
    &amp;lt;label class="radio"&amp;gt;
      &amp;lt;input type="radio" name="gender" value="other"&amp;gt;
      Other
    &amp;lt;/label&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

  &amp;lt;div class="field"&amp;gt;
    &amp;lt;div class="control"&amp;gt;
      &amp;lt;label class="checkbox"&amp;gt;
        &amp;lt;input type="checkbox"&amp;gt;
         I agree to the terms and conditions.
      &amp;lt;/label&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="field"&amp;gt;
    &amp;lt;div class="control"&amp;gt;
      &amp;lt;button class="button is-success"&amp;gt;Submit&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Column
&lt;/h3&gt;

&lt;p&gt;Columns are a fundamental part of website layout and design, and building a column layout with Bulma is very simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Add a columns container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add as many column elements as you want&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can set different widths for individual columns. Bulma provides several column width modifiers that can be added to one or more child column elements. The other columns will adjust their widths automatically.&lt;/p&gt;

&lt;p&gt;In the Bulma CSS, columns width can be changed to various options like&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;is-one-quarter&lt;/td&gt;
        &lt;td&gt;1/4 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;is-one-third&lt;/td&gt;
        &lt;td&gt;1/3 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;is-half&lt;/td&gt;
        &lt;td&gt;1/2 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;is-two-thirds&lt;/td&gt;
        &lt;td&gt;2/3 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;is-three-quarters&lt;/td&gt;
        &lt;td&gt;3/4&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To use these modifiers, you simply add the modifier class to the child column element:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;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;div class="columns is-multiline"&amp;gt;
  &amp;lt;!-- Product 1 --&amp;gt;
  &amp;lt;div class="column"&amp;gt;
    &amp;lt;div class="card is-one-quarter has-background-grey-light ml-2 mt-2"&amp;gt;
      &amp;lt;div class="card-image"&amp;gt;
        &amp;lt;figure class="image is-4by3"&amp;gt;
          &amp;lt;img
            src="https://user-images.githubusercontent.com/69134468/235297320-094a5a83-eb06-4933-acf5-735081d22557.png"
            alt="Product 1"
          /&amp;gt;
        &amp;lt;/figure&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="card-content"&amp;gt;
        &amp;lt;p class="title is-4"&amp;gt;Automated Browser Screenshot Testing&amp;lt;/p&amp;gt;
        &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
        &amp;lt;div class="content"&amp;gt;
          &amp;lt;p&amp;gt;
            Take Instant Automated Screenshots Across Multiple Browsers In A
            Single Click.
          &amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;


  &amp;lt;!-- Product 2 --&amp;gt;
  &amp;lt;div class="column"&amp;gt;
    &amp;lt;div class="card is-one-quarter has-background-grey-light mt-2"&amp;gt;
      &amp;lt;div class="card-image"&amp;gt;
        &amp;lt;figure class="image is-4by3"&amp;gt;
          &amp;lt;img
            src="https://user-images.githubusercontent.com/69134468/235297322-d7ca1ae4-7abd-41ce-adc5-ec3db2b134f0.png"
            alt="Product 2"
          /&amp;gt;
        &amp;lt;/figure&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="card-content"&amp;gt;
        &amp;lt;p class="title is-4"&amp;gt;LT Browser 2.0&amp;lt;/p&amp;gt;
        &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
        &amp;lt;div class="content"&amp;gt;
          &amp;lt;p&amp;gt;Next-gen browser to build, test &amp;amp; debug mobile websites.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;


  &amp;lt;!-- Product 3 --&amp;gt;
  &amp;lt;div class="column"&amp;gt;
    &amp;lt;div class="card is-one-quarter has-background-grey-light mt-2"&amp;gt;
      &amp;lt;div class="card-image"&amp;gt;
        &amp;lt;figure class="image is-4by3"&amp;gt;
          &amp;lt;img
            src="https://user-images.githubusercontent.com/69134468/235297323-b72aa7db-0e28-41fc-9cb4-3597de62557f.png"
            alt="Product 3"
          /&amp;gt;
        &amp;lt;/figure&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="card-content"&amp;gt;
        &amp;lt;p class="title is-4"&amp;gt;LT Debug&amp;lt;/p&amp;gt;
        &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
        &amp;lt;div class="content"&amp;gt;
          &amp;lt;p&amp;gt;
            Debug web pages on-the-fly with nine essential debugging tools. This
            Chrome extension makes debugging any web page a breeze.
          &amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;


  &amp;lt;!-- Product 4 --&amp;gt;
  &amp;lt;div class="column"&amp;gt;
    &amp;lt;div class="card is-one-quarter has-background-grey-light mr-2 mt-2"&amp;gt;
      &amp;lt;div class="card-image"&amp;gt;
        &amp;lt;figure class="image is-4by3"&amp;gt;
          &amp;lt;img
            src="https://user-images.githubusercontent.com/69134468/235297327-187e03a5-81c2-4657-851e-55efc10b569a.png"
            alt="Product 4"
          /&amp;gt;
        &amp;lt;/figure&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="card-content"&amp;gt;
        &amp;lt;p class="title is-4"&amp;gt;AI-Powered Test Analytics&amp;lt;/p&amp;gt;
        &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
        &amp;lt;div class="content"&amp;gt;
          &amp;lt;p&amp;gt;
            Assess high-impact quality issues with detailed Test Analytics &amp;amp;
            Observability Suite.
          &amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&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;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Bulma CSS&amp;lt;/title&amp;gt;

    &amp;lt;!--Bulma CDN--&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;header class="hero is-custom"&amp;gt;
      &amp;lt;div class="hero-body"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="columns"&amp;gt;
            &amp;lt;div class="column is-one-quarter"&amp;gt;
              &amp;lt;img
                src="https://user-images.githubusercontent.com/69134468/235296390-11fdb2a0-2909-4ac1-af00-7def636965e1.png"
                alt="Your logo"
                class="image is-64x64"
              /&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div class="column"&amp;gt;
              &amp;lt;h1 class="title is-3"&amp;gt;Buy our Products&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/header&amp;gt;
    &amp;lt;div class="columns is-multiline"&amp;gt;
      &amp;lt;!-- Product 1 --&amp;gt;
      &amp;lt;div class="column"&amp;gt;
        &amp;lt;div class="card is-one-quarter has-background-grey-light ml-2 mt-2"&amp;gt;
          &amp;lt;div class="card-image"&amp;gt;
            &amp;lt;figure class="image is-4by3"&amp;gt;
              &amp;lt;img src="https://user-images.githubusercontent.com/69134468/235297320-094a5a83-eb06-4933-acf5-735081d22557.png" alt="Product 1" /&amp;gt;
            &amp;lt;/figure&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div class="card-content"&amp;gt;
            &amp;lt;p class="title is-4"&amp;gt;Automated Browser Screenshot Testing&amp;lt;/p&amp;gt;
            &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
            &amp;lt;div class="content"&amp;gt;
              &amp;lt;p&amp;gt;
                Take Instant Automated Screenshots Across Multiple Browsers In A Single Click.
              &amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;!-- Product 2 --&amp;gt;
      &amp;lt;div class="column"&amp;gt;
        &amp;lt;div class="card is-one-quarter has-background-grey-light mt-2"&amp;gt;
          &amp;lt;div class="card-image"&amp;gt;
            &amp;lt;figure class="image is-4by3"&amp;gt;
              &amp;lt;img src="https://user-images.githubusercontent.com/69134468/235297322-d7ca1ae4-7abd-41ce-adc5-ec3db2b134f0.png" alt="Product 2" /&amp;gt;
            &amp;lt;/figure&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div class="card-content"&amp;gt;
            &amp;lt;p class="title is-4"&amp;gt;LT Browser 2.0&amp;lt;/p&amp;gt;
            &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
            &amp;lt;div class="content"&amp;gt;
              &amp;lt;p&amp;gt;
                Next-gen browser to build, test &amp;amp; debug
mobile websites.
              &amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;!-- Product 3 --&amp;gt;
      &amp;lt;div class="column"&amp;gt;
        &amp;lt;div class="card is-one-quarter has-background-grey-light mt-2"&amp;gt;
          &amp;lt;div class="card-image"&amp;gt;
            &amp;lt;figure class="image is-4by3"&amp;gt;
              &amp;lt;img src="https://user-images.githubusercontent.com/69134468/235297323-b72aa7db-0e28-41fc-9cb4-3597de62557f.png" alt="Product 3" /&amp;gt;
            &amp;lt;/figure&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div class="card-content"&amp;gt;
            &amp;lt;p class="title is-4"&amp;gt;LT Debug&amp;lt;/p&amp;gt;
            &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
            &amp;lt;div class="content"&amp;gt;
              &amp;lt;p&amp;gt;
Debug web pages on-the-fly with nine essential debugging tools. This Chrome extension makes debugging any web page a breeze.
              &amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;!-- Product 4 --&amp;gt;
      &amp;lt;div class="column"&amp;gt;
        &amp;lt;div class="card is-one-quarter has-background-grey-light mr-2 mt-2"&amp;gt;
          &amp;lt;div class="card-image"&amp;gt;
            &amp;lt;figure class="image is-4by3"&amp;gt;
              &amp;lt;img src="https://user-images.githubusercontent.com/69134468/235297327-187e03a5-81c2-4657-851e-55efc10b569a.png" alt="Product 4" /&amp;gt;
            &amp;lt;/figure&amp;gt;
          &amp;lt;/div&amp;gt;
          &amp;lt;div class="card-content"&amp;gt;
            &amp;lt;p class="title is-4"&amp;gt;AI-Powered Test Analytics&amp;lt;/p&amp;gt;
            &amp;lt;p class="subtitle is-6"&amp;gt;Free&amp;lt;/p&amp;gt;
            &amp;lt;div class="content"&amp;gt;
              &amp;lt;p&amp;gt;
                Assess high-impact quality issues with detailed Test Analytics &amp;amp; Observability Suite.
              &amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
          &amp;lt;/div&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;&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=oct_10&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;
  
  
  Best Practices for using Bulma CSS
&lt;/h3&gt;

&lt;p&gt;Knowing the best practices for using Bulma allows you to leverage the framework effectively, such as you can leverage Bulma’s pre-built components, grid system, and styling classes to build a responsive website quickly. Let’s look at some of the best practices:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow the Grid System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bulma provides a flexible grid system that helps create responsive layouts. To create a grid structure for a webpage, you can use the &lt;em&gt;columns&lt;/em&gt; and &lt;em&gt;column&lt;/em&gt; classes, along with other related classes such as &lt;em&gt;is-three-quarters, is-two-thirds, is-half, and is-one-third&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;div class="columns"&amp;gt;
  &amp;lt;div class="column is-half"&amp;gt;
    &amp;lt;!-- First Column Content --&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="column is-half"&amp;gt;
    &amp;lt;!-- Second Column Content --&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;Use Bulma Classes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bulma &lt;em&gt;CSS&lt;/em&gt; provides a set of classes that you can use to style your HTML elements. Some of the classes are button, card, container, and nav. Use these classes to style your webpage. For example, use the button class to style a button 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;button class="button"&amp;gt;Click here&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Use Bulma Modifiers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bulma offers a variety of modifiers that you can add to classes to modify their behavior without having to write a lot of custom CSS. These modifiers allow you to modify the responsiveness of the element, customize the look of Bulma elements, and so on.&lt;/p&gt;

&lt;p&gt;Some modifiers, such as &lt;em&gt;is-primary, is-info, is-success, is-warning, or is-danger&lt;/em&gt;, can be used to apply different color variations. Here is an example using the &lt;em&gt;is-primary class&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;button class="button is-primary"&amp;gt;Click here&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Follow Modularity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As discussed above, Bulma CSS is fully modular. This allows you to use individual components independently. Bulma makes it easy only to use the components you need for your project. This best practice can help you create clear, efficient, and maintainable code. Let’s say you only want the Bulma columns, you can import it directly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import "bulma/sass/utilities/_all.sass"
@import "bulma/sass/grid/columns.sass"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Use Responsive Design Features&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bulma offers built-in responsive design features to make your design optimal across different screen sizes. Bulma handles responsiveness through classes such as &lt;em&gt;is-full-mobile, is-hidden-mobile, is-desktop&lt;/em&gt;, etc.&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&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Bulma CSS&amp;lt;/title&amp;gt;


    &amp;lt;!--Bulma CDN--&amp;gt;
    &amp;lt;link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"
    /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div class="columns"&amp;gt;
      &amp;lt;div class="column is-one-third is-full-mobile"&amp;gt;
        &amp;lt;p&amp;gt;
          This column takes up one-third of the width on desktop and full width
          on mobile.
        &amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="column is-one-third is-full-mobile"&amp;gt;
        &amp;lt;p&amp;gt;
          This column takes up one-third of the width on desktop and full width
          on mobile.
        &amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="column is-desktop is-one-third is-hidden-mobile"&amp;gt;
        &amp;lt;p&amp;gt;
          This column takes up one-third of the width on desktop and is only
          visible in desktop screens, hidden on mobile
        &amp;lt;/p&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;h3&gt;
  
  
  Optimizing Website Performance using Bulma CSS
&lt;/h3&gt;

&lt;p&gt;In this section, we will discuss how you can optimize your website performance using the Bulma framework.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use the Minified Version&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When using Bulma CSS, always use the minified version (with the .min.css extension). Minified files are smaller in size and load faster. To include the minified version of Bulma CSS, you can use the following code:&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 rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The non-minified version of Bulma CSS looks something like this:&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 rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.css"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Use the Modularity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Import only what you need. If you want to use the button on your webpage, only include the button style in your code. This will improve the loading time of a website and overall optimize the website’s performance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import "bulma/sass/utilities/_all.sass"
@import "bulma/sass/elements/button.sass"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Frequent DOM Manipulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Frequent &lt;a href="https://www.lambdatest.com/blog/document-object-model/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_10&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;DOM&lt;/a&gt; manipulations can negatively impact website performance. If you make small changes, the browser has to re-render the page, and it can be costly.&lt;/p&gt;

&lt;p&gt;CSS frameworks like Bulma can help reduce manipulations. These frameworks provide pre-built components and CSS classes that can help create an interactive UI without writing a lot of custom CSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Caching&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Bulma CSS framework can increase website performance by using caching. Bulma is known for its efficiency and lightweight nature, and its code is more optimized for caching. In comparison to custom CSS, Bulma CSS code can be cached better.&lt;/p&gt;

&lt;p&gt;To increase cache performance, you can use minified CSS files and CDN support. Minified files are smaller and load faster, while a CDN (Content Delivery Network) is a network of servers distributed worldwide. When a user requests a CSS file, it is served from the nearest server, improving caching performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Minimizing HTTP requests&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By minimizing HTTP requests, you can increase website performance. This will improve SEO ranking, user experience, and faster load times.&lt;/p&gt;

&lt;p&gt;The Bulma CSS framework can optimize website performance. You can use minified files, which make files smaller and minimize HTTP requests. Additionally, you can use Bulma’s CDN support, which reduces request latency. Combining smaller files into a single file can also reduce the number of requests the browser has to make.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus: Bulma vs. Bootstrap
&lt;/h3&gt;

&lt;p&gt;Bulma and Bootstrap are popular CSS frameworks used to build responsive and mobile-first websites.&lt;/p&gt;

&lt;p&gt;They are free and open-source CSS frameworks with some key differences.&lt;/p&gt;

&lt;h3&gt;
  
  
  Design
&lt;/h3&gt;

&lt;p&gt;Bulma provides a modern and minimalist design that is easy to customize. It uses a simple and flexible grid system based on the CSS Flexbox module.&lt;/p&gt;

&lt;p&gt;Bootstrap has a more traditional design with a heavy reliance on pre-built components such as buttons, forms, navigation menus, etc.&lt;/p&gt;

&lt;p&gt;Let’s take a scenario where we want to customize the appearance of form input (font size &amp;amp; color).&lt;/p&gt;

&lt;p&gt;With Bulma:&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;input class="input my-input" type="text" placeholder="Enter text"&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;.my-input {
  font-size: 18px;
  color: blue;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have added the custom class “&lt;em&gt;my-input.&lt;/em&gt;” This code will customize our input form fields, such as setting the font size to 18px and the color to blue. You have direct control over the specific properties that you want to customize.&lt;/p&gt;

&lt;p&gt;With Bootstrap:&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;input class="form-control my-input" type="text" placeholder="Enter text"&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;.my-input {
  font-size: 18px !important;
  color: blue !important;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same as Bulma, we have added a custom class called “my-input” to our input element. To override the default style and use our customizations, we used the “!important” declaration in CSS. This ensures that our custom styles take precedence over the default styles.&lt;/p&gt;

&lt;p&gt;It is important to note that the use of “&lt;em&gt;!important”&lt;/em&gt; should be done sparingly, as it can make your stylesheets difficult to maintain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flexibility
&lt;/h3&gt;

&lt;p&gt;Both frameworks are suitable for creating responsive websites, but Bulma is more flexible than Bootstrap. Bulma’s styling is minimal, which means you have more control over the appearance of individual components, such as font size, color, etc.&lt;/p&gt;

&lt;p&gt;Bootstrap has a lot of pre-built styles that are applied to elements by default, which can make it more challenging to customize the appearance of a component.&lt;/p&gt;

&lt;p&gt;Same as above, it becomes challenging when it comes to customizing the default style of a Bootstrap element, but in the case of Bulma, it is more flexible.&lt;/p&gt;

&lt;h3&gt;
  
  
  Easy-to-learn syntax
&lt;/h3&gt;

&lt;p&gt;Both Bulma and Bootstrap have easy-to-learn syntax, but they have slight differences in their approach. Bulma has a more straightforward and self-explanatory syntax. Bulma has simple and readable class names, such as &lt;em&gt;.button or .title.&lt;/em&gt; It also has direct modifiers, such as &lt;em&gt;.is-primary or .is-large,&lt;/em&gt; which makes it easy to understand and know their purpose.&lt;/p&gt;

&lt;p&gt;The Bootstrap syntax may require consulting the documentation to fully grasp the class naming conventions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bulma:&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 class="button is-primary is-rounded is-large"&amp;gt;Click here&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bootstrap:&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 class="btn btn-primary rounded-lg btn-lg"&amp;gt;Click here&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In both the above examples, the intention is to style the button with a primary color, rounded corners, and increased size. The Bulma syntax looks easy to understand, but the Bootstrap syntax looks abbreviated and requires some familiarity with the framework.&lt;/p&gt;

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

&lt;p&gt;Bootstrap is a popular framework with a large user base and support community. Therefore, finding solutions to advanced problems is more likely to be achieved with Bootstrap than with Bulma.&lt;/p&gt;

&lt;p&gt;On StackOverflow, there have been over 3k questions asked about the Bulma CSS framework. Bulma has over 47.3k Stars on GitHub.&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=oct_10&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;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Bulma is a free, open-source, and lightweight CSS framework based on Flexbox layout. It provides CSS classes to help you style your HTML code, allowing developers to implement CSS on web pages more efficiently than plain CSS.&lt;/p&gt;

&lt;p&gt;In this guide, we looked at the Bulma CSS framework in detail, its features and components, best practices for using Bulma, and how Bulma can help optimize website performance.&lt;/p&gt;

&lt;p&gt;So, if developers have to import only what they need, developers have to style web pages without writing a single line of JavaScript code and more. This all can be done by using the Bulma CSS framework.&lt;/p&gt;

</description>
      <category>css</category>
      <category>automationtesting</category>
      <category>softwaretesting</category>
    </item>
    <item>
      <title>Demystifying CSS Min(), Max(), and Clamp() Functions</title>
      <dc:creator>SatyamTripathi</dc:creator>
      <pubDate>Tue, 10 Oct 2023 05:41:35 +0000</pubDate>
      <link>https://dev.to/satyamtripathi651/demystifying-css-min-max-and-clamp-functions-fpm</link>
      <guid>https://dev.to/satyamtripathi651/demystifying-css-min-max-and-clamp-functions-fpm</guid>
      <description>&lt;p&gt;A website that is interactive and responsive provides a better user experience on all devices. This engages users and encourages them to spend more time on the site. As per the report by NN Group, most users leave a webpage within 10 to 20 seconds, but a clear value proposition can make them stay longer. To make users remain for several minutes, you must communicate your value proposition clearly within the first 10 seconds.&lt;/p&gt;

&lt;p&gt;When users can access all of the site’s features on any device without any issues, such websites are more likely to rank higher in search results. This can increase traffic to the website. Key KPIs like average time spent on a page, bounce rate, sessions, conversion rate, etc., are all interconnected with the website experience. The better the web experience, the higher the time spent on the site, which might lead to increased conversions.&lt;/p&gt;

&lt;p&gt;Since your target users can access the website from a range of devices, it’s imperative to invest in improving the responsiveness and accessibility factors of the website. This is where you can leverage the benefits offered by &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=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS media queries&lt;/a&gt; and CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions.&lt;/p&gt;

&lt;p&gt;In this blog, we deep dive into the CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions and explore how to use them for creating flexible &amp;amp; &lt;a href="https://www.lambdatest.com/blog/some-common-layout-ideas-for-web-pages/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;dynamic web layouts&lt;/a&gt;. The learnings of this blog will further help you improve the overall digital experience of your web product (or offering).&lt;/p&gt;

&lt;p&gt;Without ado, let’s get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Want to convert your HTML code into BBCode? Look no further, Use our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-bbcode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to BBCode&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your website’s HTML content to BBCode format&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;CSS provides various functions that make websites more responsive and dynamic. The CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions can help keep your web designs responsive and flexible. Font size adjusts as per the viewport size of the device on which the website is being rendered. For this, you can use the CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions to specify a range of font sizes that will adjust based on screen size. For example, if the screen is small, the font size would be set to a smaller size and vice versa.&lt;/p&gt;

&lt;p&gt;The image below is taken from LT Browser 2.0.&lt;/p&gt;

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

&lt;p&gt;LT Browser 2.0 is a dev-friendly Chromium-based browser to perform &lt;a href="https://www.lambdatest.com/learning-hub/responsive-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive testing&lt;/a&gt; across 53+ pre-installed device viewports for mobile, tablet, desktop, and laptops. It has several features that will make your responsive design development a breeze. Some include side-by-side comparisons, getting performance reports, generating JavaScript error reports, and much more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to convert HTML to XML? Our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-xml?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to XML&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter is fast, easy to use, and completely free. Convert your HTML files to XML in just a few seconds&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you can see the above example of a website that adapts to any device viewports, whether a laptop, tablet, or phone, without creating any issues with the design. This website is designed to automatically adjust its text, images, layout, and other elements to fit any screen, making it dynamic and easy to use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Min()&lt;/em&gt;&lt;/strong&gt; returns a minimum value from the list of values passed to the function, which is used for setting the width, font size, etc., to the minimum value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Max()&lt;/em&gt;&lt;/strong&gt; returns the maximum value from a list of values passed in so that width, font size, etc., can be set to the maximum value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Clamp()&lt;/em&gt;&lt;/strong&gt; takes three comma-separated values: a minimum value, a preferred value, and a maximum value. It returns the preferred value if it’s within the range. Otherwise, it returns the minimum or maximum value accordingly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s dive deep into each of them in more detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the min() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;em&gt;min()&lt;/em&gt; function returns a minimum value from a list of comma-separated values. It sets the minimum width, padding, font size, etc.&lt;/p&gt;

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

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

&lt;p&gt;The &lt;em&gt;min()&lt;/em&gt; function takes one or more values and compares them to obtain the minimum value. The following CSS code can be used to set the width of a box, and it uses the &lt;em&gt;min()&lt;/em&gt; function to compare two values: 50vw (which represents 50% of the viewport width) and 400px.&lt;/p&gt;

&lt;p&gt;As the viewport width changes, the 50vw value will also change, ensuring that the elements will never be smaller than either 400px or 50vw of the available viewport width, whichever is smaller.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.lambdatest.com/blog/css-viewport-units/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Viewports&lt;/a&gt; &lt;strong&gt;width&lt;/strong&gt; is the width of the visible area on your screen when you open a webpage. It can differ based on the size of the devices (laptops, tablets, phones).&lt;/p&gt;

&lt;p&gt;In the device below, you can see that the viewport width is 1366px. Therefore, 50% of 1366px would be 683px, and the minimum of 683px &amp;amp; 400px would be 400px, so that the box width would be 400px.&lt;/p&gt;

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

&lt;p&gt;In the device below, the viewport width is 1024px, and 50% of the viewport width would be 512px. The minimum of 400px and 512px would be 400px so the box width will be set to 400px.&lt;/p&gt;

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

&lt;p&gt;If you keep changing the viewport width, the box size will also change, as seen in the below device. For the below device, the viewport width is 414px, so 50% of the viewport width would be 207px. Now, the minimum of 207px &amp;amp; 400px would be 207px, so the box width will be set to 207px.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Make the conversion from&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/yaml-to-json?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;YAML to JSON&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;quick and easy with our free online converter YAML to JSON converter tool. No signup or installation required. Try it now&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---AFEhpqO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3okeCd7fMBtA1aWR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---AFEhpqO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3okeCd7fMBtA1aWR.png" alt="image" width="800" height="381"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;50%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;lt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(50vw, 400px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;50%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code is trying to change the width of a rectangular box, but you can also change its height, font size, margin, padding, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the max() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;em&gt;max()&lt;/em&gt; function is a function that returns a maximum value from a list of comma-separated values. It is used to set the maximum width, padding, font size, etc.&lt;/p&gt;

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

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

&lt;p&gt;The &lt;em&gt;max()&lt;/em&gt; function takes one or more values and compares them to get the maximum value. The following CSS code can be used to set the width of a box, and it uses the &lt;em&gt;max()&lt;/em&gt; function to compare two values: 45vw (which represents 45% of the viewport width) and 400px.&lt;/p&gt;

&lt;p&gt;As the viewport width changes, the 45vw value will also change, ensuring that the elements will never be larger than either 400px or 45vw of the available viewport width, whichever is larger.&lt;/p&gt;

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

&lt;p&gt;In the device below, you can see that the box width is 615px. When the viewport’s width is 1366px, 45% of 1366px would be around 615px. Therefore, the box width would be a maximum of 400px &amp;amp; 615px.&lt;/p&gt;

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

&lt;p&gt;Now: in the below device, the viewport width is 1024px; if you calculate 45% of 1024px, it would be around 461px. The box width would be a maximum of 400px &amp;amp; 461px, i.e., 461px.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the below device, the viewport width is 414px, so if you find 45% of the viewport width (414px), it would be around 186px, but the maximum of 186px and 400px would be 400px so that the box width will set to 400px.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Looking for an easy way to convert your HTML files to JSON? Try our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-json?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to JSON&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your HTML files to JSON format in seconds&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ko6jO1sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATwmU8ISrXm7WMlKH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ko6jO1sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATwmU8ISrXm7WMlKH.png" alt="image" width="411" height="793"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: max(&amp;lt;span class="max"&amp;gt;45%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;gt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: max(45vw, 400px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: max(&amp;lt;span class="max"&amp;gt;45%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What does the clamp() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Clamp()&lt;/strong&gt; is a CSS function that allows you to set a value between a minimum and maximum range. Or, in simple terms, it will set the value within the lower and upper limits. The &lt;strong&gt;clamp()&lt;/strong&gt; function takes three values: The first is a minimum value, the second is a preferred value, and the third is a maximum value.&lt;/p&gt;

&lt;p&gt;The clamp() function will return the preferred value unless it exceeds the minimum value. If the preferred value exceeds the maximum value, it will return the maximum value, which means it will neither exceed the minimum or maximum value.&lt;/p&gt;

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

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

&lt;p&gt;where&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MIN&lt;/strong&gt;: represents the minimum value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;VAL&lt;/strong&gt;: represents the preferred value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MAX&lt;/strong&gt;: represents the maximum value.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s consider an example for better understanding:&lt;/p&gt;

&lt;p&gt;Suppose you are making a website. You want your main content to cover 50% of the area so that it does not become very narrow on smaller screens and not wide on larger screens. Therefore, you can set the minimum and maximum values according to available space. The width would be 250px to 400px, and it would not exceed 50% of the viewport width.&lt;/p&gt;

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

&lt;p&gt;In the device below, you can see that the viewport width is 1366px. The 50% of the viewport width would be 683px. Since we have set the maximum value to 400px, the box width would be 400px.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to convert HTML data to CSV format? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-csv?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to CSV&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your HTML data into CSV format quickly and easily. Try it out today.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the below device, the viewport width is 1024px. Although 50% of the viewport width would be 512px, we have set the maximum value to 400px. Therefore, the box width cannot exceed 400px, resulting in a box width of 400px.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the device below, the viewport width is 414px. The 50% of the 414px would be 207px. But we have set the minimum value to 250px, so the box width would be 250px.&lt;/p&gt;

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

&lt;p&gt;You might have considered how the &lt;em&gt;clamp()&lt;/em&gt; function calculates its values. For example, &lt;code&gt;clamp&lt;/code&gt;(250px, 50%, 400px) can be written as &lt;code&gt;max&lt;/code&gt;(250px, min(50%, 400px).&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="parent"&amp;gt;
  &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;
  &amp;lt;code class="value"
    &amp;gt;width: clamp(&amp;lt;span class="max"&amp;gt;250px&amp;lt;/span&amp;gt;, &amp;lt;span class="pref"&amp;gt;50%&amp;lt;/span&amp;gt;,
    &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
  &amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;div class="rectangle"&amp;gt;
  &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const maxVal = parseInt(document.querySelector('.max').innerText, 10);
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth === maxVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.pref').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else if (rectWidth === minVal) {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.pref').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.pref').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.value {
  border-radius: 0px;
  padding: 0.5em 0.25em;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  width: clamp(250px, 50%, 400px);
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.box {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.value {
  border-radius: 0px;
  padding: 0.5em 0.25em;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  width: clamp(250px, 50%, 400px);
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.box {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;So, to simplify the above code, we can break it down into simple code.&lt;/p&gt;

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

&lt;p&gt;In the above code, we have separated the minimum and maximum width from the &lt;em&gt;calc()&lt;/em&gt; function, making the code easier to understand and debug.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;calc()&lt;/em&gt; function in CSS allows you to perform simple arithmetic operations. You can use different units like pixels or percentages, and the function gives you a single value after evaluating the expression you provide.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Simplify the process of converting&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/json-to-html?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;JSON to HTML&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with our efficient online JSON to HTML converter to convert your JSON data to HTML code quickly and easily.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the below device, the box width is 800px, though the box-width should be greater than 800px according to the above code. We have also set that the width cannot exceed 800px (max-width: 800px).&lt;/p&gt;

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

&lt;p&gt;In the below device, the width is between the minimum width (400px) and maximum width (800px), i.e., 492px. Here the width would be according to &lt;em&gt;calc(50vw — 20px)&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the below device, the box width is 300px, i.e., the minimum width.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xfYfsODz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AKHbE3YwvVrDD4qGs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xfYfsODz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AKHbE3YwvVrDD4qGs.png" alt="image" width="353" height="687"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
   let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box').innerText = rectWidth + 'px';;
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  min-width: 300px;
  max-width: 800px;
  width: calc(50vw - 20px);
}

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  min-width: 300px;
  max-width: 800px;
  width: calc(50vw - 20px);
}

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using min(), max(), and clamp() with HSL functions
&lt;/h3&gt;

&lt;p&gt;According to the official documentation, the hsl() functional notation expresses RGB color according to its hue, saturation, and lightness components.&lt;/p&gt;

&lt;p&gt;HSL is a way to specify colors in web design. It lets you choose the hue (what color it is), saturation (how strong the color is), and lightness (how bright or dark the color is). With the CSS min(), max(), and clamp() functions, you can change the saturation and lightness values of your HSL colors more flexibly and dynamically. This gives you more control over how your website looks.&lt;/p&gt;

&lt;p&gt;Look at the below code, and we’re setting the background color of an element using the HSL color model, wherein the hue value is set to 50 degrees, the saturation value is set as the maximum between 50%, and the value assigned to the custom property “–saturation,” and the lightness is set to 50%.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gqiTQ7HT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5TUFbQz2vvPXOvmb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gqiTQ7HT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5TUFbQz2vvPXOvmb.png" alt="image" width="800" height="206"&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --saturation: 65%;
}

.box {
  background-color: hsl(50, max(50%, var(--saturation)), 50%);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, you can use the &lt;em&gt;min()&lt;/em&gt; function. The below code shows that the lightness will never go below 30%. Here the lightness would be a minimum of 30% or the value of a custom property called –lightness.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Struggling to create a responsive design? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/px-to-rem-converter?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Px to REM&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter to quickly convert your CSS pixel values to REM values for a smooth and easy design process.&lt;/em&gt;&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --lightness: 65%;
}

.box {
  background-color: hsl(50, 50%, min(30%, var(--lightness)));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s say you want to set the saturation value of an HSL color to a value between 40% and 60%, regardless of the value of the &lt;em&gt;–saturation&lt;/em&gt; custom property. You can use the &lt;em&gt;clamp()&lt;/em&gt; function to achieve this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3F5FU0PI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AO1OqzB6W69uZMd20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3F5FU0PI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AO1OqzB6W69uZMd20.png" alt="image" width="800" height="189"&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --saturation: 65%;
}

.box {
  background-color: hsl(60, clamp(40%, var(--saturation), 60%), 50%);

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Practices for using CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;While creating a responsive website that can adjust to different screen sizes, the use of CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions would be a smart choice because these help you to create a flexible layout. However, to use these functions effectively, there are some best practices you should keep in mind to avoid minor problems with the layout.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using CSS min(), max(), and clamp() functions with relative units
&lt;/h3&gt;

&lt;p&gt;Using fixed units alone, like pixels, doesn’t work well for different sizes, which can make your site unresponsive. For example, if you want the container to be 600px on desktop screens and 300px on phone screens, you can use relative units like %, the CSS &lt;em&gt;min()&lt;/em&gt; function, and &lt;em&gt;media queries&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;A relative unit such as em, rem, or percentage can make your design more responsive and flexible. When you use a relative unit with margin or padding, the elements will adjust to different screen sizes according to space availability. Website users can change the font size without compromising the website’s layout.&lt;/p&gt;

&lt;p&gt;When the screen size is greater than 767px (a common breakpoint for mobile devices), the container’s width will be at least 100% of the parent width and 600px. In the image below, the box width is 600px because it is a larger screen.&lt;/p&gt;

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

&lt;p&gt;On smaller screens, the container width will be either 100% of the parent’s width or 300px, whichever is smaller. This is specified inside a media query that targets small screens, such as phones, allowing the container to adjust to the available screen space. In the image below, the box size is 300px because the screen is smaller.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--REU1GlbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A8wjUqiIEBMKg-669.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--REU1GlbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A8wjUqiIEBMKg-669.png" alt="image" width="473" height="875"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

@media (max-width: 767px) {
  .rectangle {
    width: min(100%, 300px);
  }
}
  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&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://www.lambdatest.com/free-online-tools/binary-to-decimal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Binary to Decimal Converter&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;is a tool that converts binary numbers into their equivalent decimal form. Simply enter a binary number and let this converter do it for you.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Avoid using CSS min(), max(), and clamp() functions for fixed values
&lt;/h3&gt;

&lt;p&gt;We can use &lt;em&gt;CSS min(), max(), and clamp()&lt;/em&gt; functions with fixed values, but it’s not recommended. These functions are meant to make the layout responsive and adaptable.&lt;br&gt;&lt;br&gt;
When used with fixed values, they may produce a different outcome and can add unnecessary complexity. To understand this better, let’s look at the following code examples.&lt;/p&gt;

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

&lt;p&gt;The images below show that the box width is the same in all the devices. So there is no need to use these functions here. Width, height, and font size could also be replaced by &lt;em&gt;width: 300px, height: 200px, and font-size: 20px&lt;/em&gt;.&lt;/p&gt;

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

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ALsdKr02--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AJDqCTYHLveW_Gh5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ALsdKr02--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AJDqCTYHLveW_Gh5e.png" alt="image" width="451" height="813"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box-width"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Box Height: &amp;lt;span class="box-height"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box-font"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
  let pageWidth = window.innerWidth;
  let rectWidth = document.querySelector('.rectangle').clientWidth;
  let rectHeight = document.querySelector('.rectangle').clientHeight;
  let rectFont = document.querySelector('.rectangle');
  let styles = getComputedStyle(rectFont);
  let fontSize = styles.getPropertyValue('font-size');

  document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box-width').innerText = rectWidth + 'px';
  document.querySelector('.box-height').innerText = rectHeight + 'px';
  document.querySelector('.box-font').innerText = fontSize;
}

updateValues();
window.onresize = updateValues;
&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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.rectangle {
  width: min(300px, 400px);
  height: max(100px, 200px);
  font-size: clamp(10px, 20px, 100px);
}

.box-width,
.box-height,
.box-font {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box-width"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Box Height: &amp;lt;span class="box-height"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box-font"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above CSS code, the width is always 300px, and the height is always 200px. Therefore, there is no need to use the &lt;em&gt;CSS min() or max()&lt;/em&gt; functions to specify these values. Instead, you can simply use &lt;em&gt;width: 300px&lt;/em&gt; and &lt;em&gt;height: 200px&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;clamp() function&lt;/em&gt; is used to set values within a range. However, since the &lt;em&gt;font-size&lt;/em&gt; is fixed at 20px in this case, using the &lt;em&gt;clamp() function&lt;/em&gt; is unnecessary. Therefore, you can specify the &lt;em&gt;font-size&lt;/em&gt; directly as 20px.&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=oct_09&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;h3&gt;
  
  
  Avoid overusing CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;Using &lt;em&gt;CSS min(), max(), and clamp()&lt;/em&gt; functions can be helpful, but it’s essential to use them wisely to avoid making your code unnecessarily complex and difficult to maintain. Overuse of these functions can make your code harder to read and understand.&lt;/p&gt;

&lt;p&gt;Suppose you have a section in your website with two images placed side-by-side, and you want to adjust their size based on the screen size. To do this, you can use the following CSS:&lt;/p&gt;

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

&lt;p&gt;The CSS code sets the width and height of each image to a value of either 50% of the container width or 200px, whichever is smaller. Note that the fixed value of 200px may only work well on a small or very large screen.&lt;/p&gt;

&lt;p&gt;In the output below, you can see that both images adjust as the screen size changes. You can make them even more interactive by using media queries to ensure that the images are sized correctly for each screen and that the styling is consistent across all screens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cmUpgSAA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADu6ZzzIczeGbBd8U.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cmUpgSAA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADu6ZzzIczeGbBd8U.png" alt="image" width="800" height="380"&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;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt; &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;&amp;lt;/section&amp;gt;
&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;section {
  display: flex;
}

img {
  width: min(50%, 200px);
  height: min(50%, 200px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;section&amp;gt;
  &amp;lt;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To adjust the width and height of the images based on the screen size, it’s better to use media queries. Here’s an example:&lt;/p&gt;

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

&lt;p&gt;The code uses &lt;em&gt;media queries&lt;/em&gt; to adjust the &lt;em&gt;width&lt;/em&gt; and &lt;em&gt;height&lt;/em&gt; of each image based on the screen size. It sets the default values for each property outside of any media query and overrides those values using media queries based on the screen size.&lt;/p&gt;

&lt;p&gt;In the output below, both images adjust as the device changes. We used &lt;em&gt;media queries&lt;/em&gt; instead of relying on the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions and the result is more interactive.&lt;/p&gt;

&lt;p&gt;On the tablet device, both images adjust themselves based on the available space, which was different when we were using the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions.&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;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&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;section {
  display: flex;
}

img {
  width: 50%;
  height: auto;
}

@media screen and (min-width: 768px) {
  img {
    max-width: 50%;
    max-height: 200px;
  }
}

@media screen and (min-width: 1024px) {
  img {
    max-width: 200px;
    max-height: 50%;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;section&amp;gt;
  &amp;lt;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try not to overuse the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions in your projects. Although they can be helpful in some situations, using them excessively or unnecessarily can result in complex and hard-to-maintain styles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/binary-to-octal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Binary to Octal&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 binary number to octal format. Enter a binary number and convert it to an octal number.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Fallback Values
&lt;/h3&gt;

&lt;p&gt;While using the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions, it’s essential to use fallback values for browsers that do not support these functions. To ensure that your layout remains flexible, providing fallback values is crucial. According to this &lt;strong&gt;report&lt;/strong&gt;, browsers like &lt;em&gt;Internet Explorer (IE)&lt;/em&gt; do not support these functions, but IE still has a &lt;em&gt;2.51%&lt;/em&gt; share of the global desktop browser market.&lt;/p&gt;

&lt;p&gt;To ensure that your layout remains flexible, it’s essential to provide fallback values. Let’s have a look at the browser compatibility of the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://caniuse.com/?search=min%28%29"&gt;Min()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://caniuse.com/?search=max%28%29"&gt;Max()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://caniuse.com/?search=clamp%28%29"&gt;Clamp()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Suppose you have the following CSS code.&lt;/p&gt;

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

&lt;p&gt;If the browser doesn’t support the clamp function, the font size won’t be set. To ensure it’s kept in all browsers, we can use the fallback values as shown below:&lt;/p&gt;

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

&lt;p&gt;If the browser doesn’t support the &lt;em&gt;clamp()&lt;/em&gt; function, the font size will be set to a fixed value of &lt;em&gt;20px&lt;/em&gt;. It’s essential to provide fallback values so that when these CSS functions aren’t supported, they can use other fixed values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros of CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;CSS min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions are powerful functions for creating dynamic and responsive layouts. To determine whether or not to use these functions in your projects, it is crucial to consider their pros.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flexible values&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the example code, the function sets the width to either 10% of the viewport width or 100px, depending on which value is smaller. This allows the width to adjust dynamically based on the available space on the web page, ensuring a responsive layout.&lt;/p&gt;

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

&lt;p&gt;In the image below, the box width is automatically set to 100px. As the device changes, the box width will adjust accordingly. In this case, the viewport width is 1366px, and 10vw would represent 10% of that, approximately 136px. Since the minimum of 136px and 100px is 100px, the box width is set to 100px.&lt;/p&gt;

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

&lt;p&gt;In the image below, the box width is automatically set to 41px. As the device changes, the box width will adjust accordingly. In this case, the viewport width is 412px, and 10vw would represent 10% of that, approximately 41px. Since the minimum of 41px and 100px is 41px, the box width is set to 41px.&lt;/p&gt;

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

&lt;p&gt;These two images show that using flexible values with the &lt;em&gt;CSS min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can make our website more responsive and dynamic.&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="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;10vw&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;100px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;lt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(10vw, 100px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(10vw, 100px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Simplified Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can use CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions to simplify code and make it easier to read and maintain.&lt;/p&gt;

&lt;p&gt;Media queries are commonly used to adjust styles based on the device screen size, viewport dimensions, and orientation. It helps developers customize the styles for different devices and &lt;a href="https://www.lambdatest.com/blog/css-viewport-units/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS viewport units&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, we can use the clamp() function to define a range of font sizes for different screen sizes and limit it by maximum and minimum values. This means we don’t need to use media queries to adjust font size on other devices.&lt;/p&gt;

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

&lt;p&gt;It can be easily replaced by the &lt;em&gt;clamp()&lt;/em&gt; function.&lt;/p&gt;

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

&lt;p&gt;In the below images, you can see that the font size varies as we change the devices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O7BHtrlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AFrEMIi_XWWKNIqQ7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O7BHtrlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AFrEMIi_XWWKNIqQ7.png" alt="image" width="800" height="469"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
   let rectFont = document.querySelector('.rectangle');
  let styles = getComputedStyle(rectFont);
  let fontSize = styles.getPropertyValue('font-size');

    document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box').innerText = fontSize;
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

.rectangle {
  font-size: 3rem;
}
@media (max-width: 1300px) {
  .rectangle {
    font-size: calc(-2rem + 5vw);
  }
}
@media (max-width: 900px) {
  .rectangle {
    font-size: 2rem;
  }
} 
  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

.rectangle {
  font-size: 3rem;
}
@media (max-width: 1300px) {
  .rectangle {
    font-size: calc(-2rem + 5vw);
  }
}
@media (max-width: 900px) {
  .rectangle {
    font-size: 2rem;
  }
} 
  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/octal-to-decimal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Convert octal to decimal&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;quickly and easily with our free online converter tool. Try it now for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These functions can help improve accessibility by allowing users to adjust font sizes and styles to meet their needs. People with special abilities might need larger text sizes or more contrast between text and background. Using these functions can make it easier to create responsive designs that accommodate these needs without compromising the overall look and feel.&lt;/p&gt;

&lt;p&gt;To &lt;a href="https://www.lambdatest.com/accessibility-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;test for accessibility&lt;/a&gt; of your webpages or mobile apps so that people with special abilities can access your website or application, LambdaTest enables you to perform &lt;a href="https://www.lambdatest.com/learning-hub/accessibility-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;accessibility testing&lt;/a&gt; across 3000+ desktop browsers, browser versions, and operating systems.&lt;/p&gt;

&lt;p&gt;%[ &lt;a href="https://youtu.be/rkdi2L7XtE4"&gt;https://youtu.be/rkdi2L7XtE4&lt;/a&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"&gt;LambdaTest YouTube Channel&lt;/a&gt; to learn about software testing automation tools like &lt;a href="https://www.lambdatest.com/selenium?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Selenium&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/playwright-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Playwright&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/appium-mobile-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Appium&lt;/a&gt;, and many more tutorials.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;clamp()&lt;/em&gt; function can set a range of font sizes that automatically adjust according to the screen’s width. This ensures that users can read the text without it being too small or too large, even if they zoom in or out on the page.&lt;/p&gt;

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

&lt;p&gt;The &lt;em&gt;clamp()&lt;/em&gt; function used here sets a minimum font size of 18px, a preferred font size of 3.5% of the viewport width, and a maximum font size of 28px. This ensures that the font size scales smoothly between these values based on the screen size.&lt;/p&gt;

&lt;p&gt;Additionally, most modern browsers like Chrome, Firefox, Safari, and Edge support the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. However, older browsers like Internet Explorer (IE) don’t support them, and we can ensure through &lt;a href="https://www.lambdatest.com/blog/does-browser-testing-on-internet-explorer-still-make-sense/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;browser testing on IE&lt;/a&gt; if it still makes sense. To ensure that your website is accessible to all users, you should provide fallback values for browsers that don’t support these functions.&lt;/p&gt;

&lt;p&gt;We talked about fallback values in the best practices section for using the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and *clamp()*functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shortcomings of CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;Though there are numerous advantages of using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions, there are a few shortcomings as well. Some of the major ones are mentioned below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complexity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can make the code complex and harder to understand, mainly if used excessively or improperly. While these functions offer flexible layout options, they may be challenging for new developers to read and understand.&lt;/p&gt;

&lt;p&gt;Nesting multiple functions within each other is a common issue when using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. This can lead to increased complexity, making it harder to maintain and debug in the long run. For example&lt;/p&gt;

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

&lt;p&gt;This code calculates an element’s width using a combination of CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions, which can be challenging to understand at first glance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can be hard to debug compared to other &lt;a href="https://www.lambdatest.com/css-all-property?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;CSS properties&lt;/a&gt;, especially when using complex calculations or multiple variables. This can take more time and be more challenging to fix. Errors can happen due to &lt;em&gt;syntax&lt;/em&gt;, &lt;em&gt;calculation&lt;/em&gt;, &lt;em&gt;compatibility&lt;/em&gt;, or &lt;em&gt;complexity issues&lt;/em&gt;, making debugging difficult.&lt;/p&gt;

&lt;p&gt;Suppose a developer is working on responsive &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=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;modern web designs&lt;/a&gt; and wants to adjust the &lt;a href="https://www.lambdatest.com/blog/css-font-spacing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS font spacing&lt;/a&gt; and size of the heading based on the viewport width using the &lt;em&gt;clamp()&lt;/em&gt; function. See the below examples.&lt;/p&gt;

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

&lt;p&gt;If the developer unintentionally uses the &lt;em&gt;min()&lt;/em&gt; function instead of &lt;em&gt;clamp()&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;In such a scenario, the font size will always be set to the smallest value, irrespective of the viewport width. Detecting this mistake can be challenging since the code will compile without errors.&lt;/p&gt;

&lt;p&gt;Let’s look at the examples of both of the above scenarios.&lt;/p&gt;

&lt;p&gt;The image below shows that the text size changes as the browser window size changes. This is because we use the &lt;em&gt;clamp()&lt;/em&gt; function, which changes the font size for the viewport width.&lt;/p&gt;

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

&lt;p&gt;In the image below, you can see that the text size is almost the same as the device changes. This is because we are using the &lt;em&gt;min()&lt;/em&gt; function. In this case, the font size will always be set to the smallest input value, regardless of the viewport width.&lt;/p&gt;

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

&lt;p&gt;Fixing this error can be more complicated than correcting other CSS issues, especially if the code involves multiple calculations or variables.&lt;/p&gt;

&lt;p&gt;Intuited to learn how to perform responsive testing, watch our video on performing responsive testing on the LambdaTest platform.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Browser Support&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some older browsers, such as Internet Explorer (IE), don’t support them. Therefore, it is essential to provide fallback values for browsers that don’t support these functions to ensure your website works for everyone. According to this report, IE still has a &lt;em&gt;2.51%&lt;/em&gt; share of the global desktop browser market.&lt;/p&gt;

&lt;p&gt;Testing your website in Internet Explorer (IE) is essential to ensure compatibility with older browsers that some users may still be using. Even though fewer people use IE these days. By &lt;a href="https://www.lambdatest.com/test-on-internet-explorer-browsers?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;testing your website in IE&lt;/a&gt;, you can ensure that it works properly for all users, regardless of their browser. See the below graph by StatCounter; it keeps decreasing, which shows that it is not popular but still in use by 2.15 percent of global internet users.&lt;/p&gt;

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

&lt;p&gt;Here are some tips for testing your website in IE:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check Browser Support:&lt;/strong&gt; Check which versions of IE your website supports before testing. If older versions are no longer widely used, skip testing on them to save time and effort.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Virtual Machines:&lt;/strong&gt; You can use virtual machines to test your website on multiple versions of IE without installing each version on your local machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test on Real Devices:&lt;/strong&gt; Virtual machines help test your website in different IE versions, but &lt;a href="https://www.lambdatest.com/real-device-cloud?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;testing on real devices&lt;/a&gt; is important to ensure your website works correctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consider Alternatives:&lt;/strong&gt; If users with modern browsers mainly access your website, you may drop support for older versions of IE.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also check out helpful CSS functions like &lt;strong&gt;&lt;em&gt;calc()&lt;/em&gt;&lt;/strong&gt;, as well as CSS values in which you will learn absolute, relative units, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/decimal-to-binary?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Decimal to Binary&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter is a free online tool that will give you the binary equivalent of any decimal number. Enter your number, then simply click ‘convert’.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this article, we took a look at CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. We have understood these functions deeply with examples of each. We have also learned the best practices for using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions in your layout so that you can make a more responsive and flexible website. Ultimately, we have seen the pros and cons of using these functions, followed by browser &lt;a href="https://www.lambdatest.com/blog/basics-of-compatibility-testing/?utm_source=medium&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;compatibility testing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, in short, the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can help keep your web designs responsive and flexible. Say you want the font size to be flexible so that it changes as the screen size changes. For this, you can use CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions by passing a range of font sizes that will change based on the screen size like if the screen is small, the font size will be set to small and vice-versa.&lt;/p&gt;

</description>
      <category>automationtesting</category>
      <category>softwaretesting</category>
    </item>
    <item>
      <title>Demystifying CSS Min(), Max(), and Clamp() Functions</title>
      <dc:creator>SatyamTripathi</dc:creator>
      <pubDate>Mon, 09 Oct 2023 09:20:58 +0000</pubDate>
      <link>https://dev.to/satyamtripathi651/demystifying-css-min-max-and-clamp-functions-ac2</link>
      <guid>https://dev.to/satyamtripathi651/demystifying-css-min-max-and-clamp-functions-ac2</guid>
      <description>&lt;p&gt;A website that is interactive and responsive provides a better user experience on all devices. This engages users and encourages them to spend more time on the site. As per the report by NN Group, most users leave a webpage within 10 to 20 seconds, but a clear value proposition can make them stay longer. To make users remain for several minutes, you must communicate your value proposition clearly within the first 10 seconds.&lt;/p&gt;

&lt;p&gt;When users can access all of the site’s features on any device without any issues, such websites are more likely to rank higher in search results. This can increase traffic to the website. Key KPIs like average time spent on a page, bounce rate, sessions, conversion rate, etc., are all interconnected with the website experience. The better the web experience, the higher the time spent on the site, which might lead to increased conversions.&lt;/p&gt;

&lt;p&gt;Since your target users can access the website from a range of devices, it’s imperative to invest in improving the responsiveness and accessibility factors of the website. This is where you can leverage the benefits offered by &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=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS media queries&lt;/a&gt; and CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions.&lt;/p&gt;

&lt;p&gt;In this blog, we deep dive into the CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions and explore how to use them for creating flexible &amp;amp; &lt;a href="https://www.lambdatest.com/blog/some-common-layout-ideas-for-web-pages/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;dynamic web layouts&lt;/a&gt;. The learnings of this blog will further help you improve the overall digital experience of your web product (or offering).&lt;/p&gt;

&lt;p&gt;Without ado, let’s get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Want to convert your HTML code into BBCode? Look no further, Use our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-bbcode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to BBCode&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your website’s HTML content to BBCode format&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;CSS provides various functions that make websites more responsive and dynamic. The CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions can help keep your web designs responsive and flexible. Font size adjusts as per the viewport size of the device on which the website is being rendered. For this, you can use the CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions to specify a range of font sizes that will adjust based on screen size. For example, if the screen is small, the font size would be set to a smaller size and vice versa.&lt;/p&gt;

&lt;p&gt;The image below is taken from LT Browser 2.0.&lt;/p&gt;

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

&lt;p&gt;LT Browser 2.0 is a dev-friendly Chromium-based browser to perform &lt;a href="https://www.lambdatest.com/learning-hub/responsive-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive testing&lt;/a&gt; across 53+ pre-installed device viewports for mobile, tablet, desktop, and laptops. It has several features that will make your responsive design development a breeze. Some include side-by-side comparisons, getting performance reports, generating JavaScript error reports, and much more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to convert HTML to XML? Our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-xml?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to XML&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter is fast, easy to use, and completely free. Convert your HTML files to XML in just a few seconds&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you can see the above example of a website that adapts to any device viewports, whether a laptop, tablet, or phone, without creating any issues with the design. This website is designed to automatically adjust its text, images, layout, and other elements to fit any screen, making it dynamic and easy to use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Min()&lt;/em&gt;&lt;/strong&gt; returns a minimum value from the list of values passed to the function, which is used for setting the width, font size, etc., to the minimum value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Max()&lt;/em&gt;&lt;/strong&gt; returns the maximum value from a list of values passed in so that width, font size, etc., can be set to the maximum value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Clamp()&lt;/em&gt;&lt;/strong&gt; takes three comma-separated values: a minimum value, a preferred value, and a maximum value. It returns the preferred value if it’s within the range. Otherwise, it returns the minimum or maximum value accordingly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s dive deep into each of them in more detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the min() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;em&gt;min()&lt;/em&gt; function returns a minimum value from a list of comma-separated values. It sets the minimum width, padding, font size, etc.&lt;/p&gt;

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

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

&lt;p&gt;The &lt;em&gt;min()&lt;/em&gt; function takes one or more values and compares them to obtain the minimum value. The following CSS code can be used to set the width of a box, and it uses the &lt;em&gt;min()&lt;/em&gt; function to compare two values: 50vw (which represents 50% of the viewport width) and 400px.&lt;/p&gt;

&lt;p&gt;As the viewport width changes, the 50vw value will also change, ensuring that the elements will never be smaller than either 400px or 50vw of the available viewport width, whichever is smaller.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.lambdatest.com/blog/css-viewport-units/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Viewports&lt;/a&gt; &lt;strong&gt;width&lt;/strong&gt; is the width of the visible area on your screen when you open a webpage. It can differ based on the size of the devices (laptops, tablets, phones).&lt;/p&gt;

&lt;p&gt;In the device below, you can see that the viewport width is 1366px. Therefore, 50% of 1366px would be 683px, and the minimum of 683px &amp;amp; 400px would be 400px, so that the box width would be 400px.&lt;/p&gt;

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

&lt;p&gt;In the device below, the viewport width is 1024px, and 50% of the viewport width would be 512px. The minimum of 400px and 512px would be 400px so the box width will be set to 400px.&lt;/p&gt;

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

&lt;p&gt;If you keep changing the viewport width, the box size will also change, as seen in the below device. For the below device, the viewport width is 414px, so 50% of the viewport width would be 207px. Now, the minimum of 207px &amp;amp; 400px would be 207px, so the box width will be set to 207px.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Make the conversion from&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/yaml-to-json?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;YAML to JSON&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;quick and easy with our free online converter YAML to JSON converter tool. No signup or installation required. Try it now&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---AFEhpqO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3okeCd7fMBtA1aWR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---AFEhpqO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3okeCd7fMBtA1aWR.png" alt="image" width="800" height="381"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;50%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;lt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(50vw, 400px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;50%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code is trying to change the width of a rectangular box, but you can also change its height, font size, margin, padding, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the max() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;em&gt;max()&lt;/em&gt; function is a function that returns a maximum value from a list of comma-separated values. It is used to set the maximum width, padding, font size, etc.&lt;/p&gt;

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

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

&lt;p&gt;The &lt;em&gt;max()&lt;/em&gt; function takes one or more values and compares them to get the maximum value. The following CSS code can be used to set the width of a box, and it uses the &lt;em&gt;max()&lt;/em&gt; function to compare two values: 45vw (which represents 45% of the viewport width) and 400px.&lt;/p&gt;

&lt;p&gt;As the viewport width changes, the 45vw value will also change, ensuring that the elements will never be larger than either 400px or 45vw of the available viewport width, whichever is larger.&lt;/p&gt;

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

&lt;p&gt;In the device below, you can see that the box width is 615px. When the viewport’s width is 1366px, 45% of 1366px would be around 615px. Therefore, the box width would be a maximum of 400px &amp;amp; 615px.&lt;/p&gt;

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

&lt;p&gt;Now: in the below device, the viewport width is 1024px; if you calculate 45% of 1024px, it would be around 461px. The box width would be a maximum of 400px &amp;amp; 461px, i.e., 461px.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the below device, the viewport width is 414px, so if you find 45% of the viewport width (414px), it would be around 186px, but the maximum of 186px and 400px would be 400px so that the box width will set to 400px.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Looking for an easy way to convert your HTML files to JSON? Try our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-json?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to JSON&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your HTML files to JSON format in seconds&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ko6jO1sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATwmU8ISrXm7WMlKH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ko6jO1sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATwmU8ISrXm7WMlKH.png" alt="image" width="411" height="793"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: max(&amp;lt;span class="max"&amp;gt;45%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;gt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: max(45vw, 400px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: max(&amp;lt;span class="max"&amp;gt;45%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What does the clamp() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Clamp()&lt;/strong&gt; is a CSS function that allows you to set a value between a minimum and maximum range. Or, in simple terms, it will set the value within the lower and upper limits. The &lt;strong&gt;clamp()&lt;/strong&gt; function takes three values: The first is a minimum value, the second is a preferred value, and the third is a maximum value.&lt;/p&gt;

&lt;p&gt;The clamp() function will return the preferred value unless it exceeds the minimum value. If the preferred value exceeds the maximum value, it will return the maximum value, which means it will neither exceed the minimum or maximum value.&lt;/p&gt;

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

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

&lt;p&gt;where&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MIN&lt;/strong&gt;: represents the minimum value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;VAL&lt;/strong&gt;: represents the preferred value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MAX&lt;/strong&gt;: represents the maximum value.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s consider an example for better understanding:&lt;/p&gt;

&lt;p&gt;Suppose you are making a website. You want your main content to cover 50% of the area so that it does not become very narrow on smaller screens and not wide on larger screens. Therefore, you can set the minimum and maximum values according to available space. The width would be 250px to 400px, and it would not exceed 50% of the viewport width.&lt;/p&gt;

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

&lt;p&gt;In the device below, you can see that the viewport width is 1366px. The 50% of the viewport width would be 683px. Since we have set the maximum value to 400px, the box width would be 400px.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to convert HTML data to CSV format? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-csv?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to CSV&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your HTML data into CSV format quickly and easily. Try it out today.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the below device, the viewport width is 1024px. Although 50% of the viewport width would be 512px, we have set the maximum value to 400px. Therefore, the box width cannot exceed 400px, resulting in a box width of 400px.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the device below, the viewport width is 414px. The 50% of the 414px would be 207px. But we have set the minimum value to 250px, so the box width would be 250px.&lt;/p&gt;

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

&lt;p&gt;You might have considered how the &lt;em&gt;clamp()&lt;/em&gt; function calculates its values. For example, &lt;code&gt;clamp&lt;/code&gt;(250px, 50%, 400px) can be written as &lt;code&gt;max&lt;/code&gt;(250px, min(50%, 400px).&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="parent"&amp;gt;
  &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;
  &amp;lt;code class="value"
    &amp;gt;width: clamp(&amp;lt;span class="max"&amp;gt;250px&amp;lt;/span&amp;gt;, &amp;lt;span class="pref"&amp;gt;50%&amp;lt;/span&amp;gt;,
    &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
  &amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;div class="rectangle"&amp;gt;
  &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const maxVal = parseInt(document.querySelector('.max').innerText, 10);
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth === maxVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.pref').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else if (rectWidth === minVal) {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.pref').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.pref').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.value {
  border-radius: 0px;
  padding: 0.5em 0.25em;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  width: clamp(250px, 50%, 400px);
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.box {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.value {
  border-radius: 0px;
  padding: 0.5em 0.25em;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  width: clamp(250px, 50%, 400px);
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.box {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;So, to simplify the above code, we can break it down into simple code.&lt;/p&gt;

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

&lt;p&gt;In the above code, we have separated the minimum and maximum width from the &lt;em&gt;calc()&lt;/em&gt; function, making the code easier to understand and debug.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;calc()&lt;/em&gt; function in CSS allows you to perform simple arithmetic operations. You can use different units like pixels or percentages, and the function gives you a single value after evaluating the expression you provide.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Simplify the process of converting&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/json-to-html?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;JSON to HTML&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with our efficient online JSON to HTML converter to convert your JSON data to HTML code quickly and easily.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the below device, the box width is 800px, though the box-width should be greater than 800px according to the above code. We have also set that the width cannot exceed 800px (max-width: 800px).&lt;/p&gt;

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

&lt;p&gt;In the below device, the width is between the minimum width (400px) and maximum width (800px), i.e., 492px. Here the width would be according to &lt;em&gt;calc(50vw — 20px)&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the below device, the box width is 300px, i.e., the minimum width.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xfYfsODz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AKHbE3YwvVrDD4qGs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xfYfsODz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AKHbE3YwvVrDD4qGs.png" alt="image" width="353" height="687"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
   let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box').innerText = rectWidth + 'px';;
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  min-width: 300px;
  max-width: 800px;
  width: calc(50vw - 20px);
}

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  min-width: 300px;
  max-width: 800px;
  width: calc(50vw - 20px);
}

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using min(), max(), and clamp() with HSL functions
&lt;/h3&gt;

&lt;p&gt;According to the official documentation, the hsl() functional notation expresses RGB color according to its hue, saturation, and lightness components.&lt;/p&gt;

&lt;p&gt;HSL is a way to specify colors in web design. It lets you choose the hue (what color it is), saturation (how strong the color is), and lightness (how bright or dark the color is). With the CSS min(), max(), and clamp() functions, you can change the saturation and lightness values of your HSL colors more flexibly and dynamically. This gives you more control over how your website looks.&lt;/p&gt;

&lt;p&gt;Look at the below code, and we’re setting the background color of an element using the HSL color model, wherein the hue value is set to 50 degrees, the saturation value is set as the maximum between 50%, and the value assigned to the custom property “–saturation,” and the lightness is set to 50%.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gqiTQ7HT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5TUFbQz2vvPXOvmb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gqiTQ7HT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5TUFbQz2vvPXOvmb.png" alt="image" width="800" height="206"&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --saturation: 65%;
}

.box {
  background-color: hsl(50, max(50%, var(--saturation)), 50%);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, you can use the &lt;em&gt;min()&lt;/em&gt; function. The below code shows that the lightness will never go below 30%. Here the lightness would be a minimum of 30% or the value of a custom property called –lightness.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Struggling to create a responsive design? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/px-to-rem-converter?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Px to REM&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter to quickly convert your CSS pixel values to REM values for a smooth and easy design process.&lt;/em&gt;&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --lightness: 65%;
}

.box {
  background-color: hsl(50, 50%, min(30%, var(--lightness)));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s say you want to set the saturation value of an HSL color to a value between 40% and 60%, regardless of the value of the &lt;em&gt;–saturation&lt;/em&gt; custom property. You can use the &lt;em&gt;clamp()&lt;/em&gt; function to achieve this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3F5FU0PI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AO1OqzB6W69uZMd20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3F5FU0PI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AO1OqzB6W69uZMd20.png" alt="image" width="800" height="189"&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --saturation: 65%;
}

.box {
  background-color: hsl(60, clamp(40%, var(--saturation), 60%), 50%);

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Practices for using CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;While creating a responsive website that can adjust to different screen sizes, the use of CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions would be a smart choice because these help you to create a flexible layout. However, to use these functions effectively, there are some best practices you should keep in mind to avoid minor problems with the layout.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using CSS min(), max(), and clamp() functions with relative units
&lt;/h3&gt;

&lt;p&gt;Using fixed units alone, like pixels, doesn’t work well for different sizes, which can make your site unresponsive. For example, if you want the container to be 600px on desktop screens and 300px on phone screens, you can use relative units like %, the CSS &lt;em&gt;min()&lt;/em&gt; function, and &lt;em&gt;media queries&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;A relative unit such as em, rem, or percentage can make your design more responsive and flexible. When you use a relative unit with margin or padding, the elements will adjust to different screen sizes according to space availability. Website users can change the font size without compromising the website’s layout.&lt;/p&gt;

&lt;p&gt;When the screen size is greater than 767px (a common breakpoint for mobile devices), the container’s width will be at least 100% of the parent width and 600px. In the image below, the box width is 600px because it is a larger screen.&lt;/p&gt;

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

&lt;p&gt;On smaller screens, the container width will be either 100% of the parent’s width or 300px, whichever is smaller. This is specified inside a media query that targets small screens, such as phones, allowing the container to adjust to the available screen space. In the image below, the box size is 300px because the screen is smaller.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--REU1GlbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A8wjUqiIEBMKg-669.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--REU1GlbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A8wjUqiIEBMKg-669.png" alt="image" width="473" height="875"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

@media (max-width: 767px) {
  .rectangle {
    width: min(100%, 300px);
  }
}
  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&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://www.lambdatest.com/free-online-tools/binary-to-decimal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Binary to Decimal Converter&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;is a tool that converts binary numbers into their equivalent decimal form. Simply enter a binary number and let this converter do it for you.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Avoid using CSS min(), max(), and clamp() functions for fixed values
&lt;/h3&gt;

&lt;p&gt;We can use &lt;em&gt;CSS min(), max(), and clamp()&lt;/em&gt; functions with fixed values, but it’s not recommended. These functions are meant to make the layout responsive and adaptable.&lt;br&gt;&lt;br&gt;
When used with fixed values, they may produce a different outcome and can add unnecessary complexity. To understand this better, let’s look at the following code examples.&lt;/p&gt;

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

&lt;p&gt;The images below show that the box width is the same in all the devices. So there is no need to use these functions here. Width, height, and font size could also be replaced by &lt;em&gt;width: 300px, height: 200px, and font-size: 20px&lt;/em&gt;.&lt;/p&gt;

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

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ALsdKr02--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AJDqCTYHLveW_Gh5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ALsdKr02--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AJDqCTYHLveW_Gh5e.png" alt="image" width="451" height="813"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box-width"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Box Height: &amp;lt;span class="box-height"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box-font"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
  let pageWidth = window.innerWidth;
  let rectWidth = document.querySelector('.rectangle').clientWidth;
  let rectHeight = document.querySelector('.rectangle').clientHeight;
  let rectFont = document.querySelector('.rectangle');
  let styles = getComputedStyle(rectFont);
  let fontSize = styles.getPropertyValue('font-size');

  document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box-width').innerText = rectWidth + 'px';
  document.querySelector('.box-height').innerText = rectHeight + 'px';
  document.querySelector('.box-font').innerText = fontSize;
}

updateValues();
window.onresize = updateValues;
&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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.rectangle {
  width: min(300px, 400px);
  height: max(100px, 200px);
  font-size: clamp(10px, 20px, 100px);
}

.box-width,
.box-height,
.box-font {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box-width"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Box Height: &amp;lt;span class="box-height"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box-font"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above CSS code, the width is always 300px, and the height is always 200px. Therefore, there is no need to use the &lt;em&gt;CSS min() or max()&lt;/em&gt; functions to specify these values. Instead, you can simply use &lt;em&gt;width: 300px&lt;/em&gt; and &lt;em&gt;height: 200px&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;clamp() function&lt;/em&gt; is used to set values within a range. However, since the &lt;em&gt;font-size&lt;/em&gt; is fixed at 20px in this case, using the &lt;em&gt;clamp() function&lt;/em&gt; is unnecessary. Therefore, you can specify the &lt;em&gt;font-size&lt;/em&gt; directly as 20px.&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=oct_09&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;h3&gt;
  
  
  Avoid overusing CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;Using &lt;em&gt;CSS min(), max(), and clamp()&lt;/em&gt; functions can be helpful, but it’s essential to use them wisely to avoid making your code unnecessarily complex and difficult to maintain. Overuse of these functions can make your code harder to read and understand.&lt;/p&gt;

&lt;p&gt;Suppose you have a section in your website with two images placed side-by-side, and you want to adjust their size based on the screen size. To do this, you can use the following CSS:&lt;/p&gt;

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

&lt;p&gt;The CSS code sets the width and height of each image to a value of either 50% of the container width or 200px, whichever is smaller. Note that the fixed value of 200px may only work well on a small or very large screen.&lt;/p&gt;

&lt;p&gt;In the output below, you can see that both images adjust as the screen size changes. You can make them even more interactive by using media queries to ensure that the images are sized correctly for each screen and that the styling is consistent across all screens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cmUpgSAA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADu6ZzzIczeGbBd8U.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cmUpgSAA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADu6ZzzIczeGbBd8U.png" alt="image" width="800" height="380"&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;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt; &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;&amp;lt;/section&amp;gt;
&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;section {
  display: flex;
}

img {
  width: min(50%, 200px);
  height: min(50%, 200px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;section&amp;gt;
  &amp;lt;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To adjust the width and height of the images based on the screen size, it’s better to use media queries. Here’s an example:&lt;/p&gt;

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

&lt;p&gt;The code uses &lt;em&gt;media queries&lt;/em&gt; to adjust the &lt;em&gt;width&lt;/em&gt; and &lt;em&gt;height&lt;/em&gt; of each image based on the screen size. It sets the default values for each property outside of any media query and overrides those values using media queries based on the screen size.&lt;/p&gt;

&lt;p&gt;In the output below, both images adjust as the device changes. We used &lt;em&gt;media queries&lt;/em&gt; instead of relying on the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions and the result is more interactive.&lt;/p&gt;

&lt;p&gt;On the tablet device, both images adjust themselves based on the available space, which was different when we were using the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions.&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;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&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;section {
  display: flex;
}

img {
  width: 50%;
  height: auto;
}

@media screen and (min-width: 768px) {
  img {
    max-width: 50%;
    max-height: 200px;
  }
}

@media screen and (min-width: 1024px) {
  img {
    max-width: 200px;
    max-height: 50%;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;section&amp;gt;
  &amp;lt;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try not to overuse the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions in your projects. Although they can be helpful in some situations, using them excessively or unnecessarily can result in complex and hard-to-maintain styles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/binary-to-octal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Binary to Octal&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 binary number to octal format. Enter a binary number and convert it to an octal number.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Fallback Values
&lt;/h3&gt;

&lt;p&gt;While using the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions, it’s essential to use fallback values for browsers that do not support these functions. To ensure that your layout remains flexible, providing fallback values is crucial. According to this &lt;strong&gt;report&lt;/strong&gt;, browsers like &lt;em&gt;Internet Explorer (IE)&lt;/em&gt; do not support these functions, but IE still has a &lt;em&gt;2.51%&lt;/em&gt; share of the global desktop browser market.&lt;/p&gt;

&lt;p&gt;To ensure that your layout remains flexible, it’s essential to provide fallback values. Let’s have a look at the browser compatibility of the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://caniuse.com/?search=min%28%29"&gt;Min()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://caniuse.com/?search=max%28%29"&gt;Max()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://caniuse.com/?search=clamp%28%29"&gt;Clamp()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Suppose you have the following CSS code.&lt;/p&gt;

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

&lt;p&gt;If the browser doesn’t support the clamp function, the font size won’t be set. To ensure it’s kept in all browsers, we can use the fallback values as shown below:&lt;/p&gt;

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

&lt;p&gt;If the browser doesn’t support the &lt;em&gt;clamp()&lt;/em&gt; function, the font size will be set to a fixed value of &lt;em&gt;20px&lt;/em&gt;. It’s essential to provide fallback values so that when these CSS functions aren’t supported, they can use other fixed values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros of CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;CSS min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions are powerful functions for creating dynamic and responsive layouts. To determine whether or not to use these functions in your projects, it is crucial to consider their pros.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flexible values&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the example code, the function sets the width to either 10% of the viewport width or 100px, depending on which value is smaller. This allows the width to adjust dynamically based on the available space on the web page, ensuring a responsive layout.&lt;/p&gt;

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

&lt;p&gt;In the image below, the box width is automatically set to 100px. As the device changes, the box width will adjust accordingly. In this case, the viewport width is 1366px, and 10vw would represent 10% of that, approximately 136px. Since the minimum of 136px and 100px is 100px, the box width is set to 100px.&lt;/p&gt;

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

&lt;p&gt;In the image below, the box width is automatically set to 41px. As the device changes, the box width will adjust accordingly. In this case, the viewport width is 412px, and 10vw would represent 10% of that, approximately 41px. Since the minimum of 41px and 100px is 41px, the box width is set to 41px.&lt;/p&gt;

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

&lt;p&gt;These two images show that using flexible values with the &lt;em&gt;CSS min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can make our website more responsive and dynamic.&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="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;10vw&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;100px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;lt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(10vw, 100px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(10vw, 100px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Simplified Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can use CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions to simplify code and make it easier to read and maintain.&lt;/p&gt;

&lt;p&gt;Media queries are commonly used to adjust styles based on the device screen size, viewport dimensions, and orientation. It helps developers customize the styles for different devices and &lt;a href="https://www.lambdatest.com/blog/css-viewport-units/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS viewport units&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, we can use the clamp() function to define a range of font sizes for different screen sizes and limit it by maximum and minimum values. This means we don’t need to use media queries to adjust font size on other devices.&lt;/p&gt;

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

&lt;p&gt;It can be easily replaced by the &lt;em&gt;clamp()&lt;/em&gt; function.&lt;/p&gt;

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

&lt;p&gt;In the below images, you can see that the font size varies as we change the devices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O7BHtrlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AFrEMIi_XWWKNIqQ7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O7BHtrlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AFrEMIi_XWWKNIqQ7.png" alt="image" width="800" height="469"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
   let rectFont = document.querySelector('.rectangle');
  let styles = getComputedStyle(rectFont);
  let fontSize = styles.getPropertyValue('font-size');

    document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box').innerText = fontSize;
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

.rectangle {
  font-size: 3rem;
}
@media (max-width: 1300px) {
  .rectangle {
    font-size: calc(-2rem + 5vw);
  }
}
@media (max-width: 900px) {
  .rectangle {
    font-size: 2rem;
  }
} 
  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

.rectangle {
  font-size: 3rem;
}
@media (max-width: 1300px) {
  .rectangle {
    font-size: calc(-2rem + 5vw);
  }
}
@media (max-width: 900px) {
  .rectangle {
    font-size: 2rem;
  }
} 
  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/octal-to-decimal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Convert octal to decimal&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;quickly and easily with our free online converter tool. Try it now for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These functions can help improve accessibility by allowing users to adjust font sizes and styles to meet their needs. People with special abilities might need larger text sizes or more contrast between text and background. Using these functions can make it easier to create responsive designs that accommodate these needs without compromising the overall look and feel.&lt;/p&gt;

&lt;p&gt;To &lt;a href="https://www.lambdatest.com/accessibility-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;test for accessibility&lt;/a&gt; of your webpages or mobile apps so that people with special abilities can access your website or application, LambdaTest enables you to perform &lt;a href="https://www.lambdatest.com/learning-hub/accessibility-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;accessibility testing&lt;/a&gt; across 3000+ desktop browsers, browser versions, and operating systems.&lt;/p&gt;

&lt;p&gt;%[ &lt;a href="https://youtu.be/rkdi2L7XtE4"&gt;https://youtu.be/rkdi2L7XtE4&lt;/a&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"&gt;LambdaTest YouTube Channel&lt;/a&gt; to learn about software testing automation tools like &lt;a href="https://www.lambdatest.com/selenium?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Selenium&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/playwright-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Playwright&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/appium-mobile-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Appium&lt;/a&gt;, and many more tutorials.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;clamp()&lt;/em&gt; function can set a range of font sizes that automatically adjust according to the screen’s width. This ensures that users can read the text without it being too small or too large, even if they zoom in or out on the page.&lt;/p&gt;

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

&lt;p&gt;The &lt;em&gt;clamp()&lt;/em&gt; function used here sets a minimum font size of 18px, a preferred font size of 3.5% of the viewport width, and a maximum font size of 28px. This ensures that the font size scales smoothly between these values based on the screen size.&lt;/p&gt;

&lt;p&gt;Additionally, most modern browsers like Chrome, Firefox, Safari, and Edge support the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. However, older browsers like Internet Explorer (IE) don’t support them, and we can ensure through &lt;a href="https://www.lambdatest.com/blog/does-browser-testing-on-internet-explorer-still-make-sense/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;browser testing on IE&lt;/a&gt; if it still makes sense. To ensure that your website is accessible to all users, you should provide fallback values for browsers that don’t support these functions.&lt;/p&gt;

&lt;p&gt;We talked about fallback values in the best practices section for using the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and *clamp()*functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shortcomings of CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;Though there are numerous advantages of using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions, there are a few shortcomings as well. Some of the major ones are mentioned below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complexity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can make the code complex and harder to understand, mainly if used excessively or improperly. While these functions offer flexible layout options, they may be challenging for new developers to read and understand.&lt;/p&gt;

&lt;p&gt;Nesting multiple functions within each other is a common issue when using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. This can lead to increased complexity, making it harder to maintain and debug in the long run. For example&lt;/p&gt;

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

&lt;p&gt;This code calculates an element’s width using a combination of CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions, which can be challenging to understand at first glance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can be hard to debug compared to other &lt;a href="https://www.lambdatest.com/css-all-property?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;CSS properties&lt;/a&gt;, especially when using complex calculations or multiple variables. This can take more time and be more challenging to fix. Errors can happen due to &lt;em&gt;syntax&lt;/em&gt;, &lt;em&gt;calculation&lt;/em&gt;, &lt;em&gt;compatibility&lt;/em&gt;, or &lt;em&gt;complexity issues&lt;/em&gt;, making debugging difficult.&lt;/p&gt;

&lt;p&gt;Suppose a developer is working on responsive &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=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;modern web designs&lt;/a&gt; and wants to adjust the &lt;a href="https://www.lambdatest.com/blog/css-font-spacing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS font spacing&lt;/a&gt; and size of the heading based on the viewport width using the &lt;em&gt;clamp()&lt;/em&gt; function. See the below examples.&lt;/p&gt;

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

&lt;p&gt;If the developer unintentionally uses the &lt;em&gt;min()&lt;/em&gt; function instead of &lt;em&gt;clamp()&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;In such a scenario, the font size will always be set to the smallest value, irrespective of the viewport width. Detecting this mistake can be challenging since the code will compile without errors.&lt;/p&gt;

&lt;p&gt;Let’s look at the examples of both of the above scenarios.&lt;/p&gt;

&lt;p&gt;The image below shows that the text size changes as the browser window size changes. This is because we use the &lt;em&gt;clamp()&lt;/em&gt; function, which changes the font size for the viewport width.&lt;/p&gt;

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

&lt;p&gt;In the image below, you can see that the text size is almost the same as the device changes. This is because we are using the &lt;em&gt;min()&lt;/em&gt; function. In this case, the font size will always be set to the smallest input value, regardless of the viewport width.&lt;/p&gt;

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

&lt;p&gt;Fixing this error can be more complicated than correcting other CSS issues, especially if the code involves multiple calculations or variables.&lt;/p&gt;

&lt;p&gt;Intuited to learn how to perform responsive testing, watch our video on performing responsive testing on the LambdaTest platform.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Browser Support&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some older browsers, such as Internet Explorer (IE), don’t support them. Therefore, it is essential to provide fallback values for browsers that don’t support these functions to ensure your website works for everyone. According to this report, IE still has a &lt;em&gt;2.51%&lt;/em&gt; share of the global desktop browser market.&lt;/p&gt;

&lt;p&gt;Testing your website in Internet Explorer (IE) is essential to ensure compatibility with older browsers that some users may still be using. Even though fewer people use IE these days. By &lt;a href="https://www.lambdatest.com/test-on-internet-explorer-browsers?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;testing your website in IE&lt;/a&gt;, you can ensure that it works properly for all users, regardless of their browser. See the below graph by StatCounter; it keeps decreasing, which shows that it is not popular but still in use by 2.15 percent of global internet users.&lt;/p&gt;

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

&lt;p&gt;Here are some tips for testing your website in IE:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check Browser Support:&lt;/strong&gt; Check which versions of IE your website supports before testing. If older versions are no longer widely used, skip testing on them to save time and effort.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Virtual Machines:&lt;/strong&gt; You can use virtual machines to test your website on multiple versions of IE without installing each version on your local machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test on Real Devices:&lt;/strong&gt; Virtual machines help test your website in different IE versions, but &lt;a href="https://www.lambdatest.com/real-device-cloud?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;testing on real devices&lt;/a&gt; is important to ensure your website works correctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consider Alternatives:&lt;/strong&gt; If users with modern browsers mainly access your website, you may drop support for older versions of IE.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also check out helpful CSS functions like &lt;strong&gt;&lt;em&gt;calc()&lt;/em&gt;&lt;/strong&gt;, as well as CSS values in which you will learn absolute, relative units, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/decimal-to-binary?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Decimal to Binary&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter is a free online tool that will give you the binary equivalent of any decimal number. Enter your number, then simply click ‘convert’.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this article, we took a look at CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. We have understood these functions deeply with examples of each. We have also learned the best practices for using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions in your layout so that you can make a more responsive and flexible website. Ultimately, we have seen the pros and cons of using these functions, followed by browser &lt;a href="https://www.lambdatest.com/blog/basics-of-compatibility-testing/?utm_source=medium&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;compatibility testing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, in short, the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can help keep your web designs responsive and flexible. Say you want the font size to be flexible so that it changes as the screen size changes. For this, you can use CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions by passing a range of font sizes that will change based on the screen size like if the screen is small, the font size will be set to small and vice-versa.&lt;/p&gt;

</description>
      <category>automationtesting</category>
      <category>softwaretesting</category>
      <category>css</category>
    </item>
    <item>
      <title>Demystifying CSS Min(), Max(), and Clamp() Functions</title>
      <dc:creator>SatyamTripathi</dc:creator>
      <pubDate>Mon, 09 Oct 2023 09:20:58 +0000</pubDate>
      <link>https://dev.to/satyamtripathi651/demystifying-css-min-max-and-clamp-functions-43k0</link>
      <guid>https://dev.to/satyamtripathi651/demystifying-css-min-max-and-clamp-functions-43k0</guid>
      <description>&lt;p&gt;A website that is interactive and responsive provides a better user experience on all devices. This engages users and encourages them to spend more time on the site. As per the report by NN Group, most users leave a webpage within 10 to 20 seconds, but a clear value proposition can make them stay longer. To make users remain for several minutes, you must communicate your value proposition clearly within the first 10 seconds.&lt;/p&gt;

&lt;p&gt;When users can access all of the site’s features on any device without any issues, such websites are more likely to rank higher in search results. This can increase traffic to the website. Key KPIs like average time spent on a page, bounce rate, sessions, conversion rate, etc., are all interconnected with the website experience. The better the web experience, the higher the time spent on the site, which might lead to increased conversions.&lt;/p&gt;

&lt;p&gt;Since your target users can access the website from a range of devices, it’s imperative to invest in improving the responsiveness and accessibility factors of the website. This is where you can leverage the benefits offered by &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=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS media queries&lt;/a&gt; and CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions.&lt;/p&gt;

&lt;p&gt;In this blog, we deep dive into the CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions and explore how to use them for creating flexible &amp;amp; &lt;a href="https://www.lambdatest.com/blog/some-common-layout-ideas-for-web-pages/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;dynamic web layouts&lt;/a&gt;. The learnings of this blog will further help you improve the overall digital experience of your web product (or offering).&lt;/p&gt;

&lt;p&gt;Without ado, let’s get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Want to convert your HTML code into BBCode? Look no further, Use our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-bbcode?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to BBCode&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your website’s HTML content to BBCode format&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;CSS provides various functions that make websites more responsive and dynamic. The CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions can help keep your web designs responsive and flexible. Font size adjusts as per the viewport size of the device on which the website is being rendered. For this, you can use the CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions to specify a range of font sizes that will adjust based on screen size. For example, if the screen is small, the font size would be set to a smaller size and vice versa.&lt;/p&gt;

&lt;p&gt;The image below is taken from LT Browser 2.0.&lt;/p&gt;

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

&lt;p&gt;LT Browser 2.0 is a dev-friendly Chromium-based browser to perform &lt;a href="https://www.lambdatest.com/learning-hub/responsive-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;responsive testing&lt;/a&gt; across 53+ pre-installed device viewports for mobile, tablet, desktop, and laptops. It has several features that will make your responsive design development a breeze. Some include side-by-side comparisons, getting performance reports, generating JavaScript error reports, and much more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to convert HTML to XML? Our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-xml?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to XML&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter is fast, easy to use, and completely free. Convert your HTML files to XML in just a few seconds&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you can see the above example of a website that adapts to any device viewports, whether a laptop, tablet, or phone, without creating any issues with the design. This website is designed to automatically adjust its text, images, layout, and other elements to fit any screen, making it dynamic and easy to use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Min()&lt;/em&gt;&lt;/strong&gt; returns a minimum value from the list of values passed to the function, which is used for setting the width, font size, etc., to the minimum value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Max()&lt;/em&gt;&lt;/strong&gt; returns the maximum value from a list of values passed in so that width, font size, etc., can be set to the maximum value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Clamp()&lt;/em&gt;&lt;/strong&gt; takes three comma-separated values: a minimum value, a preferred value, and a maximum value. It returns the preferred value if it’s within the range. Otherwise, it returns the minimum or maximum value accordingly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s dive deep into each of them in more detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the min() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;em&gt;min()&lt;/em&gt; function returns a minimum value from a list of comma-separated values. It sets the minimum width, padding, font size, etc.&lt;/p&gt;

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

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

&lt;p&gt;The &lt;em&gt;min()&lt;/em&gt; function takes one or more values and compares them to obtain the minimum value. The following CSS code can be used to set the width of a box, and it uses the &lt;em&gt;min()&lt;/em&gt; function to compare two values: 50vw (which represents 50% of the viewport width) and 400px.&lt;/p&gt;

&lt;p&gt;As the viewport width changes, the 50vw value will also change, ensuring that the elements will never be smaller than either 400px or 50vw of the available viewport width, whichever is smaller.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.lambdatest.com/blog/css-viewport-units/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS Viewports&lt;/a&gt; &lt;strong&gt;width&lt;/strong&gt; is the width of the visible area on your screen when you open a webpage. It can differ based on the size of the devices (laptops, tablets, phones).&lt;/p&gt;

&lt;p&gt;In the device below, you can see that the viewport width is 1366px. Therefore, 50% of 1366px would be 683px, and the minimum of 683px &amp;amp; 400px would be 400px, so that the box width would be 400px.&lt;/p&gt;

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

&lt;p&gt;In the device below, the viewport width is 1024px, and 50% of the viewport width would be 512px. The minimum of 400px and 512px would be 400px so the box width will be set to 400px.&lt;/p&gt;

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

&lt;p&gt;If you keep changing the viewport width, the box size will also change, as seen in the below device. For the below device, the viewport width is 414px, so 50% of the viewport width would be 207px. Now, the minimum of 207px &amp;amp; 400px would be 207px, so the box width will be set to 207px.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Make the conversion from&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/yaml-to-json?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;YAML to JSON&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;quick and easy with our free online converter YAML to JSON converter tool. No signup or installation required. Try it now&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---AFEhpqO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3okeCd7fMBtA1aWR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---AFEhpqO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A3okeCd7fMBtA1aWR.png" alt="image" width="800" height="381"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;50%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;lt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(50vw, 400px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;50%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code is trying to change the width of a rectangular box, but you can also change its height, font size, margin, padding, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the max() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;The CSS &lt;em&gt;max()&lt;/em&gt; function is a function that returns a maximum value from a list of comma-separated values. It is used to set the maximum width, padding, font size, etc.&lt;/p&gt;

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

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

&lt;p&gt;The &lt;em&gt;max()&lt;/em&gt; function takes one or more values and compares them to get the maximum value. The following CSS code can be used to set the width of a box, and it uses the &lt;em&gt;max()&lt;/em&gt; function to compare two values: 45vw (which represents 45% of the viewport width) and 400px.&lt;/p&gt;

&lt;p&gt;As the viewport width changes, the 45vw value will also change, ensuring that the elements will never be larger than either 400px or 45vw of the available viewport width, whichever is larger.&lt;/p&gt;

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

&lt;p&gt;In the device below, you can see that the box width is 615px. When the viewport’s width is 1366px, 45% of 1366px would be around 615px. Therefore, the box width would be a maximum of 400px &amp;amp; 615px.&lt;/p&gt;

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

&lt;p&gt;Now: in the below device, the viewport width is 1024px; if you calculate 45% of 1024px, it would be around 461px. The box width would be a maximum of 400px &amp;amp; 461px, i.e., 461px.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the below device, the viewport width is 414px, so if you find 45% of the viewport width (414px), it would be around 186px, but the maximum of 186px and 400px would be 400px so that the box width will set to 400px.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Looking for an easy way to convert your HTML files to JSON? Try our free online&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-json?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to JSON&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your HTML files to JSON format in seconds&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ko6jO1sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATwmU8ISrXm7WMlKH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ko6jO1sR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ATwmU8ISrXm7WMlKH.png" alt="image" width="411" height="793"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: max(&amp;lt;span class="max"&amp;gt;45%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;gt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: max(45vw, 400px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: max(&amp;lt;span class="max"&amp;gt;45%&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What does the clamp() function do in CSS?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Clamp()&lt;/strong&gt; is a CSS function that allows you to set a value between a minimum and maximum range. Or, in simple terms, it will set the value within the lower and upper limits. The &lt;strong&gt;clamp()&lt;/strong&gt; function takes three values: The first is a minimum value, the second is a preferred value, and the third is a maximum value.&lt;/p&gt;

&lt;p&gt;The clamp() function will return the preferred value unless it exceeds the minimum value. If the preferred value exceeds the maximum value, it will return the maximum value, which means it will neither exceed the minimum or maximum value.&lt;/p&gt;

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

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

&lt;p&gt;where&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MIN&lt;/strong&gt;: represents the minimum value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;VAL&lt;/strong&gt;: represents the preferred value&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MAX&lt;/strong&gt;: represents the maximum value.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s consider an example for better understanding:&lt;/p&gt;

&lt;p&gt;Suppose you are making a website. You want your main content to cover 50% of the area so that it does not become very narrow on smaller screens and not wide on larger screens. Therefore, you can set the minimum and maximum values according to available space. The width would be 250px to 400px, and it would not exceed 50% of the viewport width.&lt;/p&gt;

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

&lt;p&gt;In the device below, you can see that the viewport width is 1366px. The 50% of the viewport width would be 683px. Since we have set the maximum value to 400px, the box width would be 400px.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Need to convert HTML data to CSV format? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/html-to-csv?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;HTML to CSV&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;converter tool to convert your HTML data into CSV format quickly and easily. Try it out today.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the below device, the viewport width is 1024px. Although 50% of the viewport width would be 512px, we have set the maximum value to 400px. Therefore, the box width cannot exceed 400px, resulting in a box width of 400px.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the device below, the viewport width is 414px. The 50% of the 414px would be 207px. But we have set the minimum value to 250px, so the box width would be 250px.&lt;/p&gt;

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

&lt;p&gt;You might have considered how the &lt;em&gt;clamp()&lt;/em&gt; function calculates its values. For example, &lt;code&gt;clamp&lt;/code&gt;(250px, 50%, 400px) can be written as &lt;code&gt;max&lt;/code&gt;(250px, min(50%, 400px).&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="parent"&amp;gt;
  &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;p&amp;gt;
  &amp;lt;code class="value"
    &amp;gt;width: clamp(&amp;lt;span class="max"&amp;gt;250px&amp;lt;/span&amp;gt;, &amp;lt;span class="pref"&amp;gt;50%&amp;lt;/span&amp;gt;,
    &amp;lt;span class="min"&amp;gt;400px&amp;lt;/span&amp;gt;);&amp;lt;/code
  &amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;div class="rectangle"&amp;gt;
  &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const maxVal = parseInt(document.querySelector('.max').innerText, 10);
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth === maxVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.pref').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else if (rectWidth === minVal) {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.pref').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.pref').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.value {
  border-radius: 0px;
  padding: 0.5em 0.25em;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  width: clamp(250px, 50%, 400px);
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.box {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.value {
  border-radius: 0px;
  padding: 0.5em 0.25em;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  width: clamp(250px, 50%, 400px);
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.box {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;So, to simplify the above code, we can break it down into simple code.&lt;/p&gt;

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

&lt;p&gt;In the above code, we have separated the minimum and maximum width from the &lt;em&gt;calc()&lt;/em&gt; function, making the code easier to understand and debug.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;calc()&lt;/em&gt; function in CSS allows you to perform simple arithmetic operations. You can use different units like pixels or percentages, and the function gives you a single value after evaluating the expression you provide.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Simplify the process of converting&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/json-to-html?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;JSON to HTML&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;with our efficient online JSON to HTML converter to convert your JSON data to HTML code quickly and easily.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the below device, the box width is 800px, though the box-width should be greater than 800px according to the above code. We have also set that the width cannot exceed 800px (max-width: 800px).&lt;/p&gt;

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

&lt;p&gt;In the below device, the width is between the minimum width (400px) and maximum width (800px), i.e., 492px. Here the width would be according to &lt;em&gt;calc(50vw — 20px)&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;Similarly, in the below device, the box width is 300px, i.e., the minimum width.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xfYfsODz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AKHbE3YwvVrDD4qGs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xfYfsODz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AKHbE3YwvVrDD4qGs.png" alt="image" width="353" height="687"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
   let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box').innerText = rectWidth + 'px';;
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  min-width: 300px;
  max-width: 800px;
  width: calc(50vw - 20px);
}

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  min-width: 300px;
  max-width: 800px;
  width: calc(50vw - 20px);
}

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using min(), max(), and clamp() with HSL functions
&lt;/h3&gt;

&lt;p&gt;According to the official documentation, the hsl() functional notation expresses RGB color according to its hue, saturation, and lightness components.&lt;/p&gt;

&lt;p&gt;HSL is a way to specify colors in web design. It lets you choose the hue (what color it is), saturation (how strong the color is), and lightness (how bright or dark the color is). With the CSS min(), max(), and clamp() functions, you can change the saturation and lightness values of your HSL colors more flexibly and dynamically. This gives you more control over how your website looks.&lt;/p&gt;

&lt;p&gt;Look at the below code, and we’re setting the background color of an element using the HSL color model, wherein the hue value is set to 50 degrees, the saturation value is set as the maximum between 50%, and the value assigned to the custom property “–saturation,” and the lightness is set to 50%.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gqiTQ7HT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5TUFbQz2vvPXOvmb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gqiTQ7HT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A5TUFbQz2vvPXOvmb.png" alt="image" width="800" height="206"&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --saturation: 65%;
}

.box {
  background-color: hsl(50, max(50%, var(--saturation)), 50%);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, you can use the &lt;em&gt;min()&lt;/em&gt; function. The below code shows that the lightness will never go below 30%. Here the lightness would be a minimum of 30% or the value of a custom property called –lightness.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Struggling to create a responsive design? Use our&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.lambdatest.com/free-online-tools/px-to-rem-converter?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Px to REM&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter to quickly convert your CSS pixel values to REM values for a smooth and easy design process.&lt;/em&gt;&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --lightness: 65%;
}

.box {
  background-color: hsl(50, 50%, min(30%, var(--lightness)));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s say you want to set the saturation value of an HSL color to a value between 40% and 60%, regardless of the value of the &lt;em&gt;–saturation&lt;/em&gt; custom property. You can use the &lt;em&gt;clamp()&lt;/em&gt; function to achieve this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3F5FU0PI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AO1OqzB6W69uZMd20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3F5FU0PI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AO1OqzB6W69uZMd20.png" alt="image" width="800" height="189"&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;div {
  width: 200px;
  height: 100px;
  margin: 1rem;
}

:root {
    --saturation: 65%;
}

.box {
  background-color: hsl(60, clamp(40%, var(--saturation), 60%), 50%);

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Practices for using CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;While creating a responsive website that can adjust to different screen sizes, the use of CSS &lt;em&gt;min(), max(),&lt;/em&gt; and &lt;em&gt;clamp()&lt;/em&gt; functions would be a smart choice because these help you to create a flexible layout. However, to use these functions effectively, there are some best practices you should keep in mind to avoid minor problems with the layout.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using CSS min(), max(), and clamp() functions with relative units
&lt;/h3&gt;

&lt;p&gt;Using fixed units alone, like pixels, doesn’t work well for different sizes, which can make your site unresponsive. For example, if you want the container to be 600px on desktop screens and 300px on phone screens, you can use relative units like %, the CSS &lt;em&gt;min()&lt;/em&gt; function, and &lt;em&gt;media queries&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;A relative unit such as em, rem, or percentage can make your design more responsive and flexible. When you use a relative unit with margin or padding, the elements will adjust to different screen sizes according to space availability. Website users can change the font size without compromising the website’s layout.&lt;/p&gt;

&lt;p&gt;When the screen size is greater than 767px (a common breakpoint for mobile devices), the container’s width will be at least 100% of the parent width and 600px. In the image below, the box width is 600px because it is a larger screen.&lt;/p&gt;

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

&lt;p&gt;On smaller screens, the container width will be either 100% of the parent’s width or 300px, whichever is smaller. This is specified inside a media query that targets small screens, such as phones, allowing the container to adjust to the available screen space. In the image below, the box size is 300px because the screen is smaller.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--REU1GlbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A8wjUqiIEBMKg-669.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--REU1GlbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2A8wjUqiIEBMKg-669.png" alt="image" width="473" height="875"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

@media (max-width: 767px) {
  .rectangle {
    width: min(100%, 300px);
  }
}
  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&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://www.lambdatest.com/free-online-tools/binary-to-decimal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Binary to Decimal Converter&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;is a tool that converts binary numbers into their equivalent decimal form. Simply enter a binary number and let this converter do it for you.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Avoid using CSS min(), max(), and clamp() functions for fixed values
&lt;/h3&gt;

&lt;p&gt;We can use &lt;em&gt;CSS min(), max(), and clamp()&lt;/em&gt; functions with fixed values, but it’s not recommended. These functions are meant to make the layout responsive and adaptable.&lt;br&gt;&lt;br&gt;
When used with fixed values, they may produce a different outcome and can add unnecessary complexity. To understand this better, let’s look at the following code examples.&lt;/p&gt;

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

&lt;p&gt;The images below show that the box width is the same in all the devices. So there is no need to use these functions here. Width, height, and font size could also be replaced by &lt;em&gt;width: 300px, height: 200px, and font-size: 20px&lt;/em&gt;.&lt;/p&gt;

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

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ALsdKr02--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AJDqCTYHLveW_Gh5e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ALsdKr02--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AJDqCTYHLveW_Gh5e.png" alt="image" width="451" height="813"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box-width"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Box Height: &amp;lt;span class="box-height"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box-font"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
  let pageWidth = window.innerWidth;
  let rectWidth = document.querySelector('.rectangle').clientWidth;
  let rectHeight = document.querySelector('.rectangle').clientHeight;
  let rectFont = document.querySelector('.rectangle');
  let styles = getComputedStyle(rectFont);
  let fontSize = styles.getPropertyValue('font-size');

  document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box-width').innerText = rectWidth + 'px';
  document.querySelector('.box-height').innerText = rectHeight + 'px';
  document.querySelector('.box-font').innerText = fontSize;
}

updateValues();
window.onresize = updateValues;
&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;body {
  font-family: "Gill Sans Extrabold", sans-serif;
  font-size: 20px;
  background-color: rgb(184, 206, 226);
  display: grid;
  place-content: center;
  text-align: center;
}

.rectangle {
  background-color: rgb(171, 208, 222);
  height: 180px;
  display: grid;
  place-content: center;
  justify-self: center;
  border: 2px solid rgb(85, 85, 233);
}

.rectangle {
  width: min(300px, 400px);
  height: max(100px, 200px);
  font-size: clamp(10px, 20px, 100px);
}

.box-width,
.box-height,
.box-font {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.viewport {
  background: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
  font-family: "Gill Sans Extrabold", sans-serif;
  padding: 0.1em 0.25em;
}

.highlight {
  background-color: rgb(222, 121, 87);
  border-bottom: 3px dashed blue;
}

.parent {
  font-size: 20px;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.line {
  height: 1px;
  width: 100%;
  background-color: blue;
}

.parent p {
  background: white;
  border: 2px solid blue;
  padding: 1rem;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;div class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box-width"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Box Height: &amp;lt;span class="box-height"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box-font"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above CSS code, the width is always 300px, and the height is always 200px. Therefore, there is no need to use the &lt;em&gt;CSS min() or max()&lt;/em&gt; functions to specify these values. Instead, you can simply use &lt;em&gt;width: 300px&lt;/em&gt; and &lt;em&gt;height: 200px&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;clamp() function&lt;/em&gt; is used to set values within a range. However, since the &lt;em&gt;font-size&lt;/em&gt; is fixed at 20px in this case, using the &lt;em&gt;clamp() function&lt;/em&gt; is unnecessary. Therefore, you can specify the &lt;em&gt;font-size&lt;/em&gt; directly as 20px.&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=oct_09&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;h3&gt;
  
  
  Avoid overusing CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;Using &lt;em&gt;CSS min(), max(), and clamp()&lt;/em&gt; functions can be helpful, but it’s essential to use them wisely to avoid making your code unnecessarily complex and difficult to maintain. Overuse of these functions can make your code harder to read and understand.&lt;/p&gt;

&lt;p&gt;Suppose you have a section in your website with two images placed side-by-side, and you want to adjust their size based on the screen size. To do this, you can use the following CSS:&lt;/p&gt;

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

&lt;p&gt;The CSS code sets the width and height of each image to a value of either 50% of the container width or 200px, whichever is smaller. Note that the fixed value of 200px may only work well on a small or very large screen.&lt;/p&gt;

&lt;p&gt;In the output below, you can see that both images adjust as the screen size changes. You can make them even more interactive by using media queries to ensure that the images are sized correctly for each screen and that the styling is consistent across all screens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cmUpgSAA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADu6ZzzIczeGbBd8U.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cmUpgSAA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2ADu6ZzzIczeGbBd8U.png" alt="image" width="800" height="380"&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;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt; &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;&amp;lt;/section&amp;gt;
&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;section {
  display: flex;
}

img {
  width: min(50%, 200px);
  height: min(50%, 200px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;section&amp;gt;
  &amp;lt;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To adjust the width and height of the images based on the screen size, it’s better to use media queries. Here’s an example:&lt;/p&gt;

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

&lt;p&gt;The code uses &lt;em&gt;media queries&lt;/em&gt; to adjust the &lt;em&gt;width&lt;/em&gt; and &lt;em&gt;height&lt;/em&gt; of each image based on the screen size. It sets the default values for each property outside of any media query and overrides those values using media queries based on the screen size.&lt;/p&gt;

&lt;p&gt;In the output below, both images adjust as the device changes. We used &lt;em&gt;media queries&lt;/em&gt; instead of relying on the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions and the result is more interactive.&lt;/p&gt;

&lt;p&gt;On the tablet device, both images adjust themselves based on the available space, which was different when we were using the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions.&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;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&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;section {
  display: flex;
}

img {
  width: 50%;
  height: auto;
}

@media screen and (min-width: 768px) {
  img {
    max-width: 50%;
    max-height: 200px;
  }
}

@media screen and (min-width: 1024px) {
  img {
    max-width: 200px;
    max-height: 50%;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;section&amp;gt;
  &amp;lt;img src="https://www.lambdatest.com/logo.png" alt="Image 1"&amp;gt;
  &amp;lt;img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_c8f5f4721cde3897dffa246c0e0bfce9/lambdatest-lambdatest.png" alt="Image 2"&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try not to overuse the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions in your projects. Although they can be helpful in some situations, using them excessively or unnecessarily can result in complex and hard-to-maintain styles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/binary-to-octal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Binary to Octal&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 binary number to octal format. Enter a binary number and convert it to an octal number.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Fallback Values
&lt;/h3&gt;

&lt;p&gt;While using the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions, it’s essential to use fallback values for browsers that do not support these functions. To ensure that your layout remains flexible, providing fallback values is crucial. According to this &lt;strong&gt;report&lt;/strong&gt;, browsers like &lt;em&gt;Internet Explorer (IE)&lt;/em&gt; do not support these functions, but IE still has a &lt;em&gt;2.51%&lt;/em&gt; share of the global desktop browser market.&lt;/p&gt;

&lt;p&gt;To ensure that your layout remains flexible, it’s essential to provide fallback values. Let’s have a look at the browser compatibility of the CSS &lt;em&gt;min(), max(), and clamp()&lt;/em&gt; functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://caniuse.com/?search=min%28%29"&gt;Min()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://caniuse.com/?search=max%28%29"&gt;Max()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://caniuse.com/?search=clamp%28%29"&gt;Clamp()&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Suppose you have the following CSS code.&lt;/p&gt;

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

&lt;p&gt;If the browser doesn’t support the clamp function, the font size won’t be set. To ensure it’s kept in all browsers, we can use the fallback values as shown below:&lt;/p&gt;

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

&lt;p&gt;If the browser doesn’t support the &lt;em&gt;clamp()&lt;/em&gt; function, the font size will be set to a fixed value of &lt;em&gt;20px&lt;/em&gt;. It’s essential to provide fallback values so that when these CSS functions aren’t supported, they can use other fixed values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros of CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;CSS min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions are powerful functions for creating dynamic and responsive layouts. To determine whether or not to use these functions in your projects, it is crucial to consider their pros.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flexible values&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the example code, the function sets the width to either 10% of the viewport width or 100px, depending on which value is smaller. This allows the width to adjust dynamically based on the available space on the web page, ensuring a responsive layout.&lt;/p&gt;

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

&lt;p&gt;In the image below, the box width is automatically set to 100px. As the device changes, the box width will adjust accordingly. In this case, the viewport width is 1366px, and 10vw would represent 10% of that, approximately 136px. Since the minimum of 136px and 100px is 100px, the box width is set to 100px.&lt;/p&gt;

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

&lt;p&gt;In the image below, the box width is automatically set to 41px. As the device changes, the box width will adjust accordingly. In this case, the viewport width is 412px, and 10vw would represent 10% of that, approximately 41px. Since the minimum of 41px and 100px is 41px, the box width is set to 41px.&lt;/p&gt;

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

&lt;p&gt;These two images show that using flexible values with the &lt;em&gt;CSS min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can make our website more responsive and dynamic.&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="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;p&amp;gt;
    &amp;lt;code class="value"
      &amp;gt;width: min(&amp;lt;span class="max"&amp;gt;10vw&amp;lt;/span&amp;gt;,
      &amp;lt;span class="min"&amp;gt;100px&amp;lt;/span&amp;gt;);&amp;lt;/code
    &amp;gt;
  &amp;lt;/p&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Box Width: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
    let rectWidth = document.querySelector('.rectangle').clientWidth;

    document.querySelector('.viewport').innerText = pageWidth + 'px';
    document.querySelector('.box').innerText = rectWidth + 'px';

    checkWidth(rectWidth);
}

const checkWidth = (rectWidth) =&amp;gt; {
    const minVal = parseInt(document.querySelector('.min').innerText, 10);

    if (rectWidth &amp;lt; minVal) {
        document.querySelector('.min').classList.remove('highlight');
        document.querySelector('.max').classList.add('highlight');
    } else {
        document.querySelector('.max').classList.remove('highlight');
        document.querySelector('.min').classList.add('highlight');
    }
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(10vw, 100px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .value {
    border-radius: 0px;
    padding: 0.5em 0.25em;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    width: min(10vw, 100px);
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

  .box {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Simplified Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can use CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions to simplify code and make it easier to read and maintain.&lt;/p&gt;

&lt;p&gt;Media queries are commonly used to adjust styles based on the device screen size, viewport dimensions, and orientation. It helps developers customize the styles for different devices and &lt;a href="https://www.lambdatest.com/blog/css-viewport-units/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS viewport units&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, we can use the clamp() function to define a range of font sizes for different screen sizes and limit it by maximum and minimum values. This means we don’t need to use media queries to adjust font size on other devices.&lt;/p&gt;

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

&lt;p&gt;It can be easily replaced by the &lt;em&gt;clamp()&lt;/em&gt; function.&lt;/p&gt;

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

&lt;p&gt;In the below images, you can see that the font size varies as we change the devices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O7BHtrlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AFrEMIi_XWWKNIqQ7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O7BHtrlc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/0%2AFrEMIi_XWWKNIqQ7.png" alt="image" width="800" height="469"&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 class="parent"&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;p&amp;gt;Viewport Width: &amp;lt;span class="viewport"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;div class="line"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

  &amp;lt;div class="rectangle"&amp;gt;
    &amp;lt;p&amp;gt;Font Size: &amp;lt;span class="box"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
&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;const updateValues = () =&amp;gt; {
    let pageWidth = window.innerWidth;
   let rectFont = document.querySelector('.rectangle');
  let styles = getComputedStyle(rectFont);
  let fontSize = styles.getPropertyValue('font-size');

    document.querySelector('.viewport').innerText = pageWidth + 'px';
  document.querySelector('.box').innerText = fontSize;
}

updateValues();
window.onresize = updateValues;
&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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

.rectangle {
  font-size: 3rem;
}
@media (max-width: 1300px) {
  .rectangle {
    font-size: calc(-2rem + 5vw);
  }
}
@media (max-width: 900px) {
  .rectangle {
    font-size: 2rem;
  }
} 
  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 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;body {
    font-family: "Gill Sans Extrabold", sans-serif;
    font-size: 20px;
    background-color: rgb(184, 206, 226);
    display: grid;
    place-content: center;
    text-align: center;
  }

  .rectangle {
    background-color: rgb(171, 208, 222);
    height: 180px;
    display: grid;
    place-content: center;
    justify-self: center;
    border: 2px solid rgb(85, 85, 233);
  }

.rectangle {
  width: min(100%, 600px);
}

.rectangle {
  font-size: 3rem;
}
@media (max-width: 1300px) {
  .rectangle {
    font-size: calc(-2rem + 5vw);
  }
}
@media (max-width: 900px) {
  .rectangle {
    font-size: 2rem;
  }
} 
  .viewport {
    background: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
    font-family: "Gill Sans Extrabold", sans-serif;
    padding: 0.1em 0.25em;
  }

  .highlight {
    background-color: rgb(222, 121, 87);
    border-bottom: 3px dashed blue;
  }

  .parent {
    font-size: 20px;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .line {
    height: 1px;
    width: 100%;
    background-color: blue;
  }

  .parent p {
    background: white;
    border: 2px solid blue;
    padding: 1rem;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/octal-to-decimal?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Convert octal to decimal&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;quickly and easily with our free online converter tool. Try it now for free.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These functions can help improve accessibility by allowing users to adjust font sizes and styles to meet their needs. People with special abilities might need larger text sizes or more contrast between text and background. Using these functions can make it easier to create responsive designs that accommodate these needs without compromising the overall look and feel.&lt;/p&gt;

&lt;p&gt;To &lt;a href="https://www.lambdatest.com/accessibility-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;test for accessibility&lt;/a&gt; of your webpages or mobile apps so that people with special abilities can access your website or application, LambdaTest enables you to perform &lt;a href="https://www.lambdatest.com/learning-hub/accessibility-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=learning_hub"&gt;accessibility testing&lt;/a&gt; across 3000+ desktop browsers, browser versions, and operating systems.&lt;/p&gt;

&lt;p&gt;%[ &lt;a href="https://youtu.be/rkdi2L7XtE4"&gt;https://youtu.be/rkdi2L7XtE4&lt;/a&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"&gt;LambdaTest YouTube Channel&lt;/a&gt; to learn about software testing automation tools like &lt;a href="https://www.lambdatest.com/selenium?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Selenium&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/playwright-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Playwright&lt;/a&gt;, &lt;a href="https://www.lambdatest.com/appium-mobile-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;Appium&lt;/a&gt;, and many more tutorials.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;clamp()&lt;/em&gt; function can set a range of font sizes that automatically adjust according to the screen’s width. This ensures that users can read the text without it being too small or too large, even if they zoom in or out on the page.&lt;/p&gt;

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

&lt;p&gt;The &lt;em&gt;clamp()&lt;/em&gt; function used here sets a minimum font size of 18px, a preferred font size of 3.5% of the viewport width, and a maximum font size of 28px. This ensures that the font size scales smoothly between these values based on the screen size.&lt;/p&gt;

&lt;p&gt;Additionally, most modern browsers like Chrome, Firefox, Safari, and Edge support the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. However, older browsers like Internet Explorer (IE) don’t support them, and we can ensure through &lt;a href="https://www.lambdatest.com/blog/does-browser-testing-on-internet-explorer-still-make-sense/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;browser testing on IE&lt;/a&gt; if it still makes sense. To ensure that your website is accessible to all users, you should provide fallback values for browsers that don’t support these functions.&lt;/p&gt;

&lt;p&gt;We talked about fallback values in the best practices section for using the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and *clamp()*functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shortcomings of CSS min(), max(), and clamp() functions
&lt;/h3&gt;

&lt;p&gt;Though there are numerous advantages of using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions, there are a few shortcomings as well. Some of the major ones are mentioned below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complexity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can make the code complex and harder to understand, mainly if used excessively or improperly. While these functions offer flexible layout options, they may be challenging for new developers to read and understand.&lt;/p&gt;

&lt;p&gt;Nesting multiple functions within each other is a common issue when using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. This can lead to increased complexity, making it harder to maintain and debug in the long run. For example&lt;/p&gt;

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

&lt;p&gt;This code calculates an element’s width using a combination of CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions, which can be challenging to understand at first glance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can be hard to debug compared to other &lt;a href="https://www.lambdatest.com/css-all-property?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;CSS properties&lt;/a&gt;, especially when using complex calculations or multiple variables. This can take more time and be more challenging to fix. Errors can happen due to &lt;em&gt;syntax&lt;/em&gt;, &lt;em&gt;calculation&lt;/em&gt;, &lt;em&gt;compatibility&lt;/em&gt;, or &lt;em&gt;complexity issues&lt;/em&gt;, making debugging difficult.&lt;/p&gt;

&lt;p&gt;Suppose a developer is working on responsive &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=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;modern web designs&lt;/a&gt; and wants to adjust the &lt;a href="https://www.lambdatest.com/blog/css-font-spacing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;CSS font spacing&lt;/a&gt; and size of the heading based on the viewport width using the &lt;em&gt;clamp()&lt;/em&gt; function. See the below examples.&lt;/p&gt;

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

&lt;p&gt;If the developer unintentionally uses the &lt;em&gt;min()&lt;/em&gt; function instead of &lt;em&gt;clamp()&lt;/em&gt;.&lt;/p&gt;

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

&lt;p&gt;In such a scenario, the font size will always be set to the smallest value, irrespective of the viewport width. Detecting this mistake can be challenging since the code will compile without errors.&lt;/p&gt;

&lt;p&gt;Let’s look at the examples of both of the above scenarios.&lt;/p&gt;

&lt;p&gt;The image below shows that the text size changes as the browser window size changes. This is because we use the &lt;em&gt;clamp()&lt;/em&gt; function, which changes the font size for the viewport width.&lt;/p&gt;

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

&lt;p&gt;In the image below, you can see that the text size is almost the same as the device changes. This is because we are using the &lt;em&gt;min()&lt;/em&gt; function. In this case, the font size will always be set to the smallest input value, regardless of the viewport width.&lt;/p&gt;

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

&lt;p&gt;Fixing this error can be more complicated than correcting other CSS issues, especially if the code involves multiple calculations or variables.&lt;/p&gt;

&lt;p&gt;Intuited to learn how to perform responsive testing, watch our video on performing responsive testing on the LambdaTest platform.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Browser Support&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some older browsers, such as Internet Explorer (IE), don’t support them. Therefore, it is essential to provide fallback values for browsers that don’t support these functions to ensure your website works for everyone. According to this report, IE still has a &lt;em&gt;2.51%&lt;/em&gt; share of the global desktop browser market.&lt;/p&gt;

&lt;p&gt;Testing your website in Internet Explorer (IE) is essential to ensure compatibility with older browsers that some users may still be using. Even though fewer people use IE these days. By &lt;a href="https://www.lambdatest.com/test-on-internet-explorer-browsers?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;testing your website in IE&lt;/a&gt;, you can ensure that it works properly for all users, regardless of their browser. See the below graph by StatCounter; it keeps decreasing, which shows that it is not popular but still in use by 2.15 percent of global internet users.&lt;/p&gt;

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

&lt;p&gt;Here are some tips for testing your website in IE:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check Browser Support:&lt;/strong&gt; Check which versions of IE your website supports before testing. If older versions are no longer widely used, skip testing on them to save time and effort.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Virtual Machines:&lt;/strong&gt; You can use virtual machines to test your website on multiple versions of IE without installing each version on your local machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test on Real Devices:&lt;/strong&gt; Virtual machines help test your website in different IE versions, but &lt;a href="https://www.lambdatest.com/real-device-cloud?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=webpage"&gt;testing on real devices&lt;/a&gt; is important to ensure your website works correctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consider Alternatives:&lt;/strong&gt; If users with modern browsers mainly access your website, you may drop support for older versions of IE.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also check out helpful CSS functions like &lt;strong&gt;&lt;em&gt;calc()&lt;/em&gt;&lt;/strong&gt;, as well as CSS values in which you will learn absolute, relative units, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/free-online-tools/decimal-to-binary?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=free_online_tools"&gt;&lt;strong&gt;&lt;em&gt;Decimal to Binary&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;Converter is a free online tool that will give you the binary equivalent of any decimal number. Enter your number, then simply click ‘convert’.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this article, we took a look at CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions. We have understood these functions deeply with examples of each. We have also learned the best practices for using CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions in your layout so that you can make a more responsive and flexible website. Ultimately, we have seen the pros and cons of using these functions, followed by browser &lt;a href="https://www.lambdatest.com/blog/basics-of-compatibility-testing/?utm_source=medium&amp;amp;utm_medium=organic&amp;amp;utm_campaign=oct_09&amp;amp;utm_term=ap&amp;amp;utm_content=blog"&gt;compatibility testing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, in short, the CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions can help keep your web designs responsive and flexible. Say you want the font size to be flexible so that it changes as the screen size changes. For this, you can use CSS &lt;em&gt;min()&lt;/em&gt;, &lt;em&gt;max()&lt;/em&gt;, and &lt;em&gt;clamp()&lt;/em&gt; functions by passing a range of font sizes that will change based on the screen size like if the screen is small, the font size will be set to small and vice-versa.&lt;/p&gt;

</description>
      <category>automationtesting</category>
      <category>softwaretesting</category>
      <category>css</category>
    </item>
  </channel>
</rss>
