关于屏幕适配问题

关于手机端的屏幕适配问题,如果不允许缩放则需添加

<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">//user-scalable=no 不允许缩放

关于手机端的屏幕适配问题可用rem作为单位

  <script>
        let htmlWidth=document.documentElement.clientWidth||document.body.clientWidth// 获取屏幕的度
        let htmlDom = document.getElementsByTagName('html')[0];//获取Dom元素
        htmlDom.style.fontSize= htmlWidth/20 + 'px';//此处以ip5为基础进行的故宽度/20 来定义的标准
    </script>

猜你喜欢

转载自www.cnblogs.com/lipu12281/p/11837912.html