CSS 媒体查询未显示在 chrome 检查器中

标签 css sass media-queries

首先,我不得不说我已经检查了关于这个问题的其他 SO 问题(比如 thisthis ),我相信我的问题与那些问题不同,并且这个问题不是那些问题的重复.

我的 CSS 文件中有一些媒体查询,如下所示:

@media only screen and (max-width: 767px) { /*css here*/}

当我检查 chrome 检查器时,我可以看到那些 CSS Angular 色从未应用于所需的元素。我尝试在检查器模式下调整屏幕大小,但这些 CSS Angular 色仍然不适用。知道什么可能导致这里的问题吗?

编辑

这是我使用的整个 CSS block 。我正在使用 SCSS 语法,我可以看到生成的 CSS Angular 色完全没问题,我得到了 filter-title-responsive 类的正确 Angular 色。

.filter-panel-container {
  @extend %select-input-fix;
  @extend %date-input-fix;
  width: 100%;
  height: auto;

  .filter-header-container {
    height: 40px;
    width: 100%;
    border-radius: 5px 5px 0 0;
    background-color: $theme_athens_gray_color;

    padding-top: 10px;
    padding-bottom: 11px;
    padding-left: 16px;

    display: flex;
    flex-direction: row;
    justify-content: start;

    & * {
      color: $theme_gulf_blue_color;
    }

    i {
      margin-top: 2px;
    }

    .filter-title {
      font-family: $Montserrat-font;
      font-size: 16px;
      font-weight: 500;
      line-height: 19px;
      margin-left: 5px;
    }

    .filter-title-responsive {
      font-size: 14px;
      margin-left: 0;
    }

    @media screen and (max-width: 1730px) {
      .filter-title-responsive {
        font-size: 12px;
      }
    }

    @media screen and (max-width: 1370px) {
      .filter-title-responsive {
        font-size: 10px;
      }
    }

    @media screen and (max-width: 1210px) {
      .filter-title-responsive {
        font-size: 7px;
      }
    }

    &.filter-header-disable {
      border: 1px solid $theme_athens_gray_color;
      border-bottom: none;
      background-color: white;
      color: $theme_athens_gray_color;
    }
  }
}

最佳答案

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

视口(viewport)元素向浏览器提供有关如何控制页面尺寸和缩放比例的说明。

width=device-width 部分设置页面的宽度以跟随设备的屏幕宽度(这会因设备而异)。

initial-scale=1.0 部分设置浏览器首次加载页面时的初始缩放级别。

关于CSS 媒体查询未显示在 chrome 检查器中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60162233/

相关文章:

css - Twitter Bootstrap - 仅在 lg 设备上使用 "container-fluid"的语义方式

添加另一个子菜单的 CSS 菜单示例

css - 在水平滚动页面上水平居中

css - 覆盖CSS变量

ruby-on-rails - 如何让 Ruby on Rails 输出 Bootstrap v3 脚手架?

html - IE 无法识别网站的媒体查询

javascript - 从移动 View 中删除 Div

javascript - 如何通过单击按钮在多个 div 中应用水平滚动?

css - 找不到 laravel mix sass 图像/哈希

html - 尝试将 z-index 与 div 一起使用