JSFiddle - React, Tailwind, and code Playground

SCSS

@function px2em($px, $metric: 'em', $base-font-size: 16px) {
      @if unitless($px) {
        @warn "Assuming #{$px} to be in pixels, attempting to convert it into pixels.";
        @return px2em($px * 1px, $metric, $base-font-size);
      } @else if unit($px) == em {
        @return $px;
      }  
      @return #{($px / $base-font-size) + $metric};
    }
    
    // Pixels to rem based on sass-mq
    @function px2rem($px) {
      @if unit($px) == rem {
        @return $px;
      }

      @return px2em($px, 'rem');
    }