@artifak/pxtoem

A utility function to convert PX values to EM.

Usage no npm install needed!

<script type="module">
  import artifakPxtoem from 'https://cdn.skypack.dev/@artifak/pxtoem';
</script>

README

@artifak/pxtoem

A utility function to convert px values to em.

Installation

Yarn

yarn add @artifak/pxtoem

NPM

npm install @artifak/pxtoem

Usage

import { pxToEm } from 'artifak';
import styled from 'styled-components';

export const Container = styled.div`
  margin: 0 auto;
  width: 100%;
  background: #000;
  padding-left: ${pxToEm('16px')};
  padding-right: ${pxToEm('16px')};
`;