Chrome 开发人员工具未显示响应能力

Chrome Developer Tool is not showing responsiveness

我在 chrome 开发人员工具上检查我的网站的响应能力时遇到问题。当我调整 chrome window 大小时,它显示响应能力

下图中chrome window宽度为768px

但是当我在 chrome 中使用 Toggle Device Toolbar 时,它没有显示响应,如下图所示。宽度为768px.

我的index.html文件如下

<!DOCTYPE html>
<html>
<head>
    <title>Personal Site</title>
    <link rel="stylesheet" type="text/css" href="./styles/style.css">
    <link rel="stylesheet" type="text/css" href="./styles/tab.css">
    <link rel="stylesheet" type="text/css" href="./styles/mobile.css">
</head>
<body>
All the Code lies here
</body>
</html>

我的CSS个文件如下

style.css

All the styles are here no media queries

tab.css

@media only screen and (max-width: 768px) and (min-width: 501px)
{
All the styles are here
}

mobile.css

@media only screen and (max-width: 500px)
{
All the styles are here
}

你脑子里漏掉了 Viewport 标签,

将此添加到您的 head 标签

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

请访问此 Document 了解更多信息