Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

52
Views
Why viewport meta tag in Chromium is invalid?

I hope my web to be Mobile browser. I already set <meta name="viewport" content=" width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;"> in my index.html,and it will display normall in Firefox.(width is device width ,not 980px).But I open the web in Mobile chrome,the layout width is 980px ,not device-width. Then I add javascript in html:

 <script>
(function () {
  function
  autoRootFontSize() {
    document.documentElement.style.fontSize = Math.min(screen.width,
    document.documentElement.getBoundingClientRect().width) / 980 * 320 + 'px';
  }
  window.addEventListener('resize', autoRootFontSize)
  autoRootFontSize();
})();

The Mobile Chrome is narmal.Then I have used the commmand 'npm run build' to package my projects and open the web,but viewport width still is 980px.

How to solve this question ?

7 months ago · Santiago Gelvez
Answer question
Find remote jobs