For example: At present I have a PSD chart, size of 640*1010, suitable for Apple 5 mobile phone .
Method steps:
1. I use font-size=10px as the initial pixel size of the 640*1010 phone; 1rem=10px;
at this time there is a text on the PSD size of 20px, that is, the current size of my font is expressed in rem:Font-size:1rem (the size of the PSD is twice times the size of the HTML, so first divided by 2 to get the correct PX, After conversion rem divided by 2 again OK)
REM units for a variety of phones:
2. Get the width: var windowwidth=$ (this) that I currently use on my phone . innerwidth ();
3. Proportional conversion get PX: windowwidth/m= 320/10 ========= (get M value) currently using the phone
4. Assign the upper x value to the HTML tag that is currently using the phone page:
JS Dynamic adaptation Mobile end font-size, Unit: REM