set(); window.onresize = set; function set() { var windowWidth = document.documentElement.clientWidth; var rate = windowWidth / 750; document.documentElement.style.fontSize = 100 * rate + "px"; }