https://github.com/hypercubed/computed-styles
Get the computed styles of a DOM element in a cross browser consistent manner
https://github.com/hypercubed/computed-styles
Last synced: about 1 year ago
JSON representation
Get the computed styles of a DOM element in a cross browser consistent manner
- Host: GitHub
- URL: https://github.com/hypercubed/computed-styles
- Owner: Hypercubed
- License: other
- Created: 2015-10-15T10:16:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-16T05:15:25.000Z (over 10 years ago)
- Last Synced: 2025-04-19T16:25:50.865Z (about 1 year ago)
- Language: JavaScript
- Size: 188 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# computed-style
[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Downloads][download-badge]][npm-url]
> Get the computed styles of a DOM element in a cross browser consistent manner
## Install
```sh
npm install computed-styles
```
## Usage
### Get computed styles
```js
import computedStyles from 'computed-styles';
computedStyles(document.querySelector('#node')) // returns computed styles as an object
```
### Convert computed styles to inline styles
```js
import computedStyles from 'computed-styles';
var node = document.querySelector('#node');
computedStyles(node, node.styles);
```
### Copy computed styles to another element
```js
import computedStyles from 'computed-styles';
var source = document.querySelector('#source');
var target = document.querySelector('#target');
computedStyles(source, target.styles);
```
See [API](API.md)
## License
MIT © [J. Harshbarger](http://github.com/Hypercubed)
[npm-url]: https://npmjs.org/package/computed-styles
[npm-image]: https://img.shields.io/npm/v/computed-styles.svg?style=flat-square
[travis-url]: https://travis-ci.org/Hypercubed/computed-styles
[travis-image]: https://img.shields.io/travis/Hypercubed/computed-styles.svg?style=flat-square
[download-badge]: http://img.shields.io/npm/dm/computed-styles.svg?style=flat-square