Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-size

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-size

measures element size

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
220K
decreased by-27.81%
Maintainers
1
Weekly downloads
 
Created

What is get-size?

The get-size npm package is used to get the size of elements in a web page. It provides a way to measure the width, height, and other dimensions of an element, including padding, border, and margin. This can be particularly useful for layout calculations and responsive design.

What are get-size's main functionalities?

Get Element Size

This feature allows you to get the width and height of a DOM element. The `getSize` function takes a DOM element as an argument and returns an object containing the width and height of the element.

const getSize = require('get-size');
const elem = document.querySelector('.element');
const size = getSize(elem);
console.log(size.width, size.height);

Get Element Size with Padding and Border

This feature allows you to get the inner width and height of a DOM element, which includes padding and border. The `getSize` function returns an object containing `innerWidth` and `innerHeight` properties.

const getSize = require('get-size');
const elem = document.querySelector('.element');
const size = getSize(elem);
console.log(size.innerWidth, size.innerHeight);

Get Element Size with Margin

This feature allows you to get the outer width and height of a DOM element, which includes margin. The `getSize` function returns an object containing `outerWidth` and `outerHeight` properties.

const getSize = require('get-size');
const elem = document.querySelector('.element');
const size = getSize(elem);
console.log(size.outerWidth, size.outerHeight);

Other packages similar to get-size

Keywords

FAQs

Package last updated on 20 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc