Skip to content

Instantly share code, notes, and snippets.

@r3a1d3a1
Last active December 2, 2020 05:39
Show Gist options
  • Save r3a1d3a1/a87a2f4e5edc95578400756e08826e63 to your computer and use it in GitHub Desktop.
Save r3a1d3a1/a87a2f4e5edc95578400756e08826e63 to your computer and use it in GitHub Desktop.
DPR/Resolution/...
alert(`DPR: ${window.devicePixelRatio},\n` +
`screen.width: ${window.screen.width}, screen.height: ${window.screen.height},\n` + //Least useful
`availWidth: ${window.screen.availWidth}, availHeight: ${window.screen.availHeight},\n` +
`innerWidth: ${window.innerWidth}, innerHeight: ${window.innerHeight}`); //Media queries are based on this
// To match inner dimensions with screen dimensions on mobiles, you can add this in the header:
// <meta name="viewport" content="width=device-width,initial-scale=1">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment