css 100vh code example

Example 1: vh and vw

/*vh viewport height and vw viewport width*/
/*example*/
div
{
  display: inline-block;
  height: 100vh; /*THis will set height equal to the height of windows*/
  width: 100vw/*This will set width equal to width of windows*/
}

Example 2: what is 100vh in css

height: 100vh = 100% of the viewport height.

Example 3: css vw not working on mobile

//In your js file:
window.addEventListener('resize', () => { 
  document.querySelector(':root').style
    .setProperty('--vw', window.innerWidth/100 + 'px');
})

//Css
width: calc(100 * var(--vw));