css-shorthand-expand

Expand CSS shorthand properties

Usage no npm install needed!

<script type="module">
  import cssShorthandExpand from 'https://cdn.skypack.dev/css-shorthand-expand';
</script>

README

css-shorthand-expand

Build Status

Expand CSS shorthand properties to their longhand equivalent.

npm install css-shorthand-expand

Usage

The module exposes a single function which takes a property name and a value and returns a map with the expanded properties.

var expand = require('css-shorthand-expand');

expand('background', 'url(image.png) no-repeat #ff0');

The above returns an object.

{
    'background-image': 'url(image.png)',
    'background-repeat': 'no-repeat',
    'background-color': '#ff0'
}

Currently the following properties are supported.

  • background
  • font
  • padding
  • margin
  • border
  • border-width
  • border-style
  • border-color
  • border-top
  • border-right
  • border-bottom
  • border-left
  • border-radius
  • outline