Skip to content

Instantly share code, notes, and snippets.

@marcusshepp
Last active September 27, 2016 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 marcusshepp/063bb098661059c30881ddfd27fa83b1 to your computer and use it in GitHub Desktop.
Save marcusshepp/063bb098661059c30881ddfd27fa83b1 to your computer and use it in GitHub Desktop.
vanilla js get width height
var element = document.querySelector("#foo");
var element_details = element.getBoundingClientRect();
var element_width = element_details.width;
var element_height = element_details.height;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment