问题
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