vh-variable

The package solves the problem with height conversion on mobile phones

Usage no npm install needed!

<script type="module">
  import vhVariable from 'https://cdn.skypack.dev/vh-variable';
</script>

README

vh-variable

A small module that declares a css variable that correctly calculates the value of 1vh.

On mobile phones there is a problem with the address bar for items with 1vh height, this package can solve this problem

Installation

Use the package manager to install vh-variable.

npm i vh-variable

Usage

import 'vh-variable'

or Common.js

require('vh-variable')

Use in code like this:

Before

selector{
    height: 100vh;
}

After

selector{
    height: calc(var(--vh, 1vh) * 100);
}