[英]@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.
在我的笔记本电脑上,当我实际缩小或放大浏览器窗口时,@ media查询将触发并更改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. 您应该在网页中添加
<meta name="viewport" content="width=device-width, initial-scale=1">
。
so that the virtual viewport matches the device dimensions. 使虚拟视口与设备尺寸匹配。
Add the Meta tag into your head section of your website. 将Meta标签添加到您网站的头部。 You will want to place the Meta tag below the other Meta tags in your head section or above your title tag.
您将需要将Meta标签放在头部的其他Meta标签之下或标题标签之上。
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. 此Meta标签告诉移动设备不要缩放。 This allows the Responsive Template for mobile devices to be loaded in the scripts.
这允许在脚本中加载移动设备的响应模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.