JSFiddle - React, Tailwind, and code Playground
by ponyspy
HTML
<div id="container">
<h1>This is my text</h1>
</div>
CSS
body, html {
height:100%;
width:100%;
}
#container {
height:75%;
width:75%;
background-color:#eeeeee;
padding:1%;
}
JavaScript
fontsize = function () {
var fontSize = $("#container").width() * 0.10; // 10% of container width
$("#container h1").css('font-size', fontSize);
};
$(window).resize(fontsize);
$(document).ready(fontsize);