Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get element size javascript

// Get Content + Padding + Border
let box = document.querySelector('div');
let width = box.offsetWidth;
let height = box.offsetHeight;

// Get Content + Padding only
let box = document.querySelector('div');
let width = box.clientWidth;
let height = box.clientHeight;
Source by www.javascripttutorial.net #
 
PREVIOUS NEXT
Tagged: #element #size #javascript
ADD COMMENT
Topic
Name
8+5 =