# b-box

> Border-box geometric information for the DOM element of HTML5

Latest version **1.0.6** (published 2025-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install b-box
pnpm add b-box
yarn add b-box
bun add b-box
```

## Health

**Score 35/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2025-09-21 |
| First published | 2017-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | vzg03566@gmail.com |
| Maintainers | vzg03566 |
| Keywords | box-sizing, border-box |

## Links

- npm: https://www.npmjs.com/package/b-box
- Repository: https://github.com/takamin/b-box
- Homepage: https://github.com/takamin/b-box#readme
- Issues: https://github.com/takamin/b-box/issues
- npm.io page: https://npm.io/package/b-box

## Recent versions

- 1.0.6 (latest) — 2025-09-21
- 1.0.4 — 2021-04-19
- 1.0.3 — 2020-07-18
- 1.0.2 — 2020-03-15
- 1.0.1 — 2019-07-14
- 1.0.0 — 2019-06-22
- 0.1.2 — 2018-04-27
- 0.1.1 — 2017-04-13
- 0.1.0 — 2017-04-09

## README

BBox - npm `b-box`
==================

Border-box geometric information for the DOM element of HTML5.

Constructor
-----------

* BBox(element)

Fields
------

* `top`
* `left`
* `right`
* `bottom`
* `width`
* `height`
* {`margin-`|`padding-`|`border-`}{`top`|`left`|`right`|`bottom`}

A Type of these fields above are _string_ that have `px` at the tail.
To retrieve a number, use `px` method.

Methods
-------

* `update`() - Updates the fields by evaluating the computed style of the
  element specified at the constructor.
* `px`(`<field-name>`) - Returns a number value of the field.
* `margin{Top|Left|Right|Bottom|Nc`() - Returns a total margin length as a
  number.
* `marginHorizontalNc`() - Returns a `marginLeftNc()+marginRightNc`.
* `marginVerticalNc`() - Returns a `marginTopNc()+marginBottomNc`.


LICENSE
-------

This software is released under the MIT License, see [LICENSE](LICENSE)

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