Skip to content

Instantly share code, notes, and snippets.

@MurakamiShinyu
Last active January 3, 2023 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MurakamiShinyu/265968c3bab8146028e6e345b9b7bb95 to your computer and use it in GitHub Desktop.
Save MurakamiShinyu/265968c3bab8146028e6e345b9b7bb95 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Check devicePixelRatio</title>
<script>
window.onload = () => {
devicePixelRatioValue.textContent = window.devicePixelRatio;
actualBorderWidthValue.textContent = testBorder.getBoundingClientRect().height;
};
</script>
<style>
#testBorder { border-top: 0.001px solid; }
</style>
</head>
<body>
<p>window.devicePixelRatio: <span id="devicePixelRatioValue"></span></p>
<p>A very thin border (#testBorder { border-top: 0.001px solid; }):</p>
<div id="testBorder"></div>
<p>testBorder.getBoundingClientRect().height: <span id="actualBorderWidthValue"></span></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment