fontSize.js 342 Bytes
function initFontSize (baseFontSize, baseWidth) {
  let clientWidth = document.documentElement.clientWidth || window.innerWidth()
  let size = Math.floor(clientWidth / baseWidth * baseFontSize)
  document.querySelector('html').style.fontSize = size + 'px'
}
initFontSize(100, 1080)
window.onresize = function () {
  initFontSize(100, 1080)
}