As you probably know if you like using CSS viewport units, the support for them (in ie) suck.
vmaxIsn't supported in any version of ie or edge.vminIsn't supported in ie9
##The CSS Viewport Units
vw: 1/100th viewport widthvh: 1/100th viewport heightvmin: 1/100th of the smallest sidevmax: 1/100th of the largest side
Note: IE9 uses vm instead of vmin. It does not support vmax.
##The CSS Viewport Units in Javascript
var vw = window.innerWidth / 100var vh = window.innerHeight / 100var vmin = Math.min(vw, vh)var vmax = Math.max(vw, vh)
###Setting your html font-size to a viewport unit and using em values everywhere, results in ridiculously responsive web pages
in CSS:
html {
font-size: calc( 2vmin + 1.4vmax + 2vh );
}
The same thing in javascript.
var vminsize = 2
var vmaxsize = 1.4
var vhsize = 2
function setSize() {
var vw = window.innerWidth / 100
var vh = window.innerHeight / 100
var vmin = Math.min(vw, vh)
var vmax = Math.max(vw, vh)
document.documentElement.style.fontSize = (( vmin * vminsize ) + ( vmax * vmaxsize ) + ( vh * vhsize )) + "px";
}
window.addEventListener("resize", setSize);
document.addEventListener("DOMContentLoaded", setSize);