# get-size-percent

> Get an element's width or height in percentage

Latest version **1.1.3** (published 2017-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-size-percent
pnpm add get-size-percent
yarn add get-size-percent
bun add get-size-percent
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2017-07-24 |
| First published | 2017-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Idan Entin |
| Maintainers | idanen |

## Links

- npm: https://www.npmjs.com/package/get-size-percent
- Repository: https://github.com/idanen/getSizePercent
- Homepage: https://github.com/idanen/getSizePercent#readme
- Issues: https://github.com/idanen/getSizePercent/issues
- npm.io page: https://npm.io/package/get-size-percent

## Recent versions

- 1.1.3 (latest) — 2017-07-24
- 1.1.2 — 2017-07-24
- 1.1.1 — 2017-07-24
- 1.1.0 — 2017-07-24
- 1.0.1 — 2017-07-24
- 1.0.0 — 2017-07-23

## README

# getSizePercent
Get an element's width or height in percentage

## Usage
```html
<style>
.my-element {
  width: 85%
}
</style>
<body>
  <div class="my-element"></div>
</body>
```
```javascript
const width = getSizePercent({ selector: '.my-element', property: 'width' });
// width === '85%'
```

## Thanks
Borrowed a nice trick from this [answer](https://stackoverflow.com/a/19873734/4119772), implementation is more stable (on some widths the calculations weren't completely accurate).

So big thanks to [timofey](https://stackoverflow.com/users/477496/timofey)

---
_Source: https://npm.io/package/get-size-percent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
