1. Use REM
2. Meta content is as follows:
<meta charset= "UTF-8" >
<meta name= "viewport" content= "width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1, User-scalable=no ">
<!--prevent your iOS device from dialing a number as a dial-up connection, automatically sending a mailbox, clicking the map--
<meta name= "format-detection" content= "Telephone=no,email=no,adress=no" >
<!--force Full-screen display-
<meta name= "Full-screen" content= "yes" >
<!--turn on support for WebApp-
<meta name= "apple-mobile-web-app-capable" content= "yes" >
<!--the color of the status bar (top bar of the screen) under the Web app, default is defaults (white)--
<meta name= "Apple-mobile-web-app-status-bar-style" content= "Black-translucent" >
<!--prevent the browser from accessing the page content from the cache--
<meta http-equiv= "Pragma" content= "No-cache" >
3, the introduction of JS code:
<script type= "Text/javascript" >
Document.documentElement.style.fontSize = document.documentelement.clientwidth/6.4 + "px";
</script>
4. Introduction of JS File
<script type= "Text/javascript" src= "Js/setfontsize.js" ></script>
The contents are as follows:
(Function (doc, win) {
var docel = doc.documentelement,//Get HTML tags
Orientationchange Direction Change Event
resizeevt = ' orientationchange ' in window? ' Orientationchange ': ' Resize ',
Recalc = function () {
Current Device viewport width
var clientwidth = docel.clientwidth;
if (!clientwidth) return;
docEl.style.fontSize = * (clientwidth/750) + ' px ';
};
if (!doc.addeventlistener) return;
Win.addeventlistener (Resizeevt, Recalc, false);
Doc.addeventlistener (' domcontentloaded ', Recalc, false); Load
}) (document, window);
5. Use REM instead of px
If 750 of the design, 100px on the design diagram
1rem defined on the iphone6 of 375
About the problem of mobile-side adaptation