get-outer-size
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

get-outer-size

NPM version Build Status Coverage Status ISC License

install

$ npm install --save get-outer-size

use

import getOuterSize from 'get-outer-size';
 
const element = document.getElementById('my-element');
const {width, height} = getOuterSize(element);
// width = element width + border width + margin-right + margin-left
// height = element width + border width + margin-top + margin-bottom

example

<div class="div"></div>
.div {
  margin: 10px 20px 15px;
  width: 100px;
  height: 100px;
}
const element = document.getElementById('my-element');
const {width, height} = getOuterSize(element);
width; // => 140 (100px + 20px + 20px)
height; // => 125 (100px + 10px + 15px)

Readme

Keywords

Package Sidebar

Install

npm i get-outer-size

Weekly Downloads

2

Version

0.1.1

License

ISC

Unpacked Size

22.9 kB

Total Files

16

Last publish

Collaborators

  • kikiki_kiki