media queries not working for samsung or ipod

2019-09-01 10:43发布

问题:

Im trying to make my website responsive, however Im having a little problem. It works fine on my browser. If my browser is full screen then it looks how it should, and if I make the browser smaller then the media queries work perfect. However if i then load onto a samsung galaxy S3 or ipod touch, it does not. It looks like the regular website, only crammed in smaller to fit the screen. It does fit 100% of the screen, however hot at all like it should. I have searched through here for an answer. I have tried changing the widths, I have tried changing px to em. I have tried being less specific and just write for portable devices. Still doesnt work. Can anyone help? This is my media query..

@media only screen and (min-width: 150px) and (max-width:600px)

回答1:

Try adding this between your head tags:

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