Responsive design - Media Query not working on iPhone?

后端 未结 3 1094
情歌与酒
情歌与酒 2020-12-24 13:21

I am trying to create a mobile friendly version of my website, to make my website responsive to a smaller screen size and scale accordingly.

I\'ve created some media

相关标签:
3条回答
  • 2020-12-24 13:32

    I just experienced the most bizarre thing after troubleshooting this same problem for a day. Something to try if all else fails...

    My pages were perfectly responsive on my laptop during development but not on my iPhone, iPad or Samsung. I finally discovered I had to put a comment line after the DOCTYPE statement and before the html lang statement, like this:

    <!DOCTYPE html>
    <!-- This comment line needed for bootstrap to work on mobile devices -->
    <html lang="en">
    

    Finally, my pages were responsive on the mobile devices. Weird!

    0 讨论(0)
  • 2020-12-24 13:50

    Do you have the meta for view port in your html?

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

    More info here: http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-dont-forget-the-viewport-meta-tag/

    0 讨论(0)
  • 2020-12-24 13:51

    I think you'll find a warning in Chrome with ; instead of , This should work just fine:

    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    0 讨论(0)
提交回复
热议问题