Why is my responsive html/css not working with mobile phone?

社会主义新天地 提交于 2020-12-27 07:25:22

问题


I've created a test site. I've used media queries in css but when I load the page on mobile, I don't see the mobile version and when I re-size the browser the site is responsive. I've read at multiple places to not to use *-device-width. So, what am I missing? What could be the resolution?


回答1:


Add this to the head of your website:

<meta name="viewport" content="width=device-width, initial-scale=1">

This will set the width of your page to follow the screen width of your device.




回答2:


It was my mistake. I used javascript to override meta tag and it was causing issue in proper responsiveness. Fixed javascript.



来源:https://stackoverflow.com/questions/45709463/why-is-my-responsive-html-css-not-working-with-mobile-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!