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 e = window, a = 'inner';
if (!('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'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();
});