媒体查询适用于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" />