<!-- rem CSS3 A new relative unit, relative to the root node (HTML) font size value roothtml{font-size:10px} 2rem=20px can only modify the size of the root element, you can proportionally adjust all the font size , relying only on the size of the HTML font--
first way: Multi-resolution setting REM settings (different resolutions in different sizes, such as IPhone6, 1rem=23px)
/*Note3*/@media only screen and (min-width:360px){html{font-size:22px!important;}}/*IPhone6*/@media only screen and (MIN-WIDTH:376PX){html{font-size:23px!important;}}/*IPhone6 plus*/@media only screen and (min-width:414px){html{font-size:25px!important;}}/*Big Resolution*/@media only screen and (min-width:641px){html{font-size:25px!important;}}
The second way: JS implementation, such as your plan is 1080px, then you use 1080/18=60px,1rem=60px
REM Layout 1, must be dynamic to set the size of the HTML, in order to fit 2, according to the page (note: Is the PSD graph, that is, the real size of large) divided by a factor, the calculated value assigned to the HTML font-size attribute 1, why to divide a number, the reason is: a page, It is not possible to have all the elements of the entire screen, there must be multiple elements in a row. So the line is divided into N 2, not apart from a number, that 1 REM is the width of the screen, the value is too large, if an element is smaller than its width, it is not convenient to calculate 3, the coefficient, self-determined. It is possible, but it is recommended to give a value divisible by the characteristics: 1, all units of the property will automatically calculate the size according to the size of the screen 2, the same element, the size of the different devices are not the same. Small display under the size of the device, the large size of the device display 3, the general Iphone6 as the benchmark, with its width 750 in addition to the previous factor, then to calculate the REM -->
<script> (function() { var html=document.documentelement; var width=Html.getboundingclientrect (). width;//Gets the window size html.style.fontSize=width/18+ ' px '; // The design figure is 1080px 1rem=60 })(); </script>
Mobile REM Use