当前位置 : 主页 > 编程语言 > java >

移动端的1px的解决方案

来源:互联网 收集:自由互联 发布时间:2022-08-10
!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.devicePixelRati
<!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 /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>

 



上一篇:JS对象数组排序
下一篇:没有了
网友评论