Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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));
 
PREVIOUS NEXT
Tagged: #css #vw #working #mobile
ADD COMMENT
Topic
Name
8+4 =