Skip to content

Instantly share code, notes, and snippets.

@shmdhussain
Last active September 5, 2020 22:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shmdhussain/fe0d442db4070126c7e97658142459d8 to your computer and use it in GitHub Desktop.
Save shmdhussain/fe0d442db4070126c7e97658142459d8 to your computer and use it in GitHub Desktop.
ViewPort Information
console.log("The Screen Width(these dimensions are measured in device pixels because they never change: they’re a feature of the monitor, and not of the browser.");
console.log("the browser width in css px is (no device pixel)" + window.innerWidth);
console.log("the browser width height in css ps is (no device pixel)" + window.innerHeight);
console.log("the layout viewport width in css px" + document.documentElement.clientWidth);
console.log("the layout viewport height in css px" + document.documentElement.clientHeight);
console.log("devicePixelRatio:"+window.devicePixelRatio)
console.log("the screen device width in dev px is " + screen.width);
console.log("the screen device height in dev px is " + screen.height);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment