简体   繁体   中英

@media query works in desktop browser, not in mobile browser

I recently updated my site to make it mobile friendly. On my laptop, when I physically make the browser window smaller or larger, the @media queries fire and change the CSS. However, on my actual mobile browser, I'm getting the desktop site. Can someone please tell me what's going on?

Include in the

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

And it will work

You should add <meta name="viewport" content="width=device-width, initial-scale=1"> in you webpage.
so that the virtual viewport matches the device dimensions.

Add the Meta tag into your head section of your website. You will want to place the Meta tag below the other Meta tags in your head section or above your title tag.

Without a viewport meta tag, your site will be rendered into the device's default virtual viewport.

This Meta tag tells the mobile device to not zoom. This allows the Responsive Template for mobile devices to be loaded in the scripts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM