// Get the width of the phone screen let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth; // Get the Dom element of html let htmlDom = document.getElementsByTagName('html')[0 ]; // Set the root element Font size htmlDom.style.fontSize= htmlWidth/20 + 'px';