You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

css-viewport-units-transform

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-viewport-units-transform

Transform CSS viewport units of a style object to pixels based on window dimensions

0.10.3
latest
Source
npmnpm
Version published
Weekly downloads
1.2K
-9.52%
Maintainers
1
Weekly downloads
 
Created
Source

css-viewport-units-transform

Build Status Build status Coverage Status Size PRs Welcome

Transform CSS viewport units of a Javascript style object to pixels based on window dimensions.

Supports vw, vh, vmin and vmax units.

import { transform } from "css-viewport-units-transform";
// or const transform = require("css-viewport-units-transform").transform;

transform(
  {
    fontSize: "10vw"
  },
  {
    width: 480,
    height: 100
  }
);

↓ ↓ ↓ ↓ ↓ ↓

{
  fontSize: 48;
}

or

transform(
  {
    myClass: {
      fontSize: "10vh"
    }
  },
  {
    width: 480,
    height: 100
  }
);

↓ ↓ ↓ ↓ ↓ ↓

{
  myClass: {
    fontSize: 10,
  }
}

Dependencies

  • None

Keywords

CSS-in-JS

FAQs

Package last updated on 05 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts