JSFiddle - React, Tailwind, and code Playground

by Rene Rubio

HTML

<h1 style="font-size: 9rem">Hello World</h1>
<h1 style="font-size: 9vw">Hello World</h1>

JavaScript

function viewport() {
    var win = window, inner = 'inner';
    if (!('innerWidth' in window )) {
        inner = 'client';
        win = document.documentElement || document.body;
    }
    return { width : win[ inner+'Width' ] , height : win[ inner+'Height' ] };
}
function updateVw(){
    var vw = (viewport().width/100);
    jQuery('html').css({
        'font-size' : vw + 'px'
    });
}
jQuery(window).ready(function(){
    updateVw();
});
jQuery(window).resize(function(){
    updateVw();
});