移动端的1px的解决方案

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <!--
            <meta name="viewport" content="width=device-width,initial-scale=.33333,minimum-scale=.33333,maximum-scale=.33333" />
        -->
        <script>
            //获取像素比
       //console.log(window.devicePixelRatio);
            var pixelRatio = 1 / window.devicePixelRatio;
            console.log(pixelRatio);
            //通过js动态设置视口(viewport)
            document.write(<meta name="viewport" content="width=device-width,initial-scale=+pixelRatio+,minimum-scale=+pixelRatio+,maximum-scale=+pixelRatio+" />);
        </script>
    </head>
    <body>
    </body>
</html>

 

移动端的1px的解决方案

上一篇:C#中AppDomain.CurrentDomain.BaseDirectory及各种路径获取方法


下一篇:Android 设置字体