媒体查询适用于Chrome,但不适用于移动设备 [英] media query working on chrome but not on mobile

查看:103
本文介绍了媒体查询适用于Chrome,但不适用于移动设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的CSS的一部分:

this is a piece of my CSS:

@media (max-width: 800px) {

    body {
        background:black;
        background-image:none;
        font-size:30px;
    }

    #logo {
        width: 100%;
        height: 100%;

    }
    .mobile {
        display: inline;
        align-content: center;
        font-size:60px;
    }
    .longtext {
        display: none;
    }
}

在chrome上,当我调整窗口大小时,它变为我想要的设置,但是当进入devtools响应式检查或在移动设备上访问时,它根本不起作用。不是一个单一的设置。

On chrome, when I resize the window it changes to the setting i wanted to, but when going to devtools responsive check or visiting on mobile, it just doesn't work. Not a single setting.

heeeelp

推荐答案

您应该添加此< head>< / head> 中的meta标签。 来自MDN的更多信息

You should add this meta tag in <head></head>. More information from MDN

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

这篇关于媒体查询适用于Chrome,但不适用于移动设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆