Test demo on GitHub: Https://github.com/fei1314/mobileDesign/tree/master
One, mobile 1.viewport (viewport): Based on the resolution of the browser adaptive<Metaname= "Viewport"content= "width=device-width,user-scalable=no,initial-scale=1.0">width=device-width: Width equals the width of the device, depending on the device user-scalable=no:user-scalable whether the user is allowed to scale, his value is a Boolean value, no means that the user is not allowed to scale the page Initia L-scale=1.0: Represents the initial scaling Minimum-scale: Minimum scaling Maximum-scale: Maximum zoom ratio 2. New Box Model Box-sizing:border-box/content-box Border-box:width/height including border padding Content-box:width/height does not include border padding 3. Elastic box Model Parent: Display:flex; Child: Flex:1 principle: Available total width-fixed occupied width = remaining space remaining space *flex/flex_sum=width 4. Media query @media (condition) {CSS code//Note Priority} 5.rem rem relative root element font size (HTML) EM relative font size font-size:12px; Width:2em = width:24px; Goal: All things can follow the size of the screen (as simple as possible) method: All the dimensions are written in rem, only need to change the fontsize principle of HTML: for different devices, the width is different, a datum screen is needed to calculate the width of the corresponding devices according to different devices. If the base screen width is 375px (as you decide), the HTML font size is 20px (as you set it). The true width of the known device clientwidth, according to the corresponding law, can calculate the corresponding true width of the font size datum screen Real screen width 375 clientwidth font?
Summary of the mobile end