📝 代码查看
2
查看次数
2026-01-18
创建时间
2026-01-18
最后更新
<h1>Device Pixel Ratio Test</h1>
<p id="devicePixelRatio"></p>
<input type="button" id="button" value="点击弹出window.devicePixelRatio" /> <script> document.getElementById("button").onclick = function() { alert(window.devicePixelRatio); }; </script>
暂无CSS代码
// 获取并显示devicePixelRatio值
document.getElementById('devicePixelRatio').textContent = 'Device Pixel Ratio: ' + window.devicePixelRatio;