CSS3 rem
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <script> (function(doc, win) { var docEl = doc.documentElement, resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', recalc = function() { var clientWidth = docEl.clientWidth; console.log(clientWidth) if(!clientWidth) return; if(clientWidth == 414) { docEl.style.fontSize = '100px'; } else { docEl.style.fontSize = 100 * (clientWidth / 414) + 'px'; } };
if(!doc.addEventListener) return; win.addEventListener(resizeEvt, recalc, false); doc.addEventListener('DOMContentLoaded', recalc, false); })(document, window); </script> <style> p{font-size:0.14rem;} a{font-size:0.14rem} div{font-size:0.14rem;width:100%;border:1px solid #f00} </style> <body> <p>aaa<a>bbb</a></p> <div>aaa</div> </body> </html>