CSS - 不应用媒体查询

时间:2017-12-14 12:24:26

标签: html css

我为我的HTML代码编写了媒体查询,但没有申请。我必须在小屏幕中显示我的文字。



@media(max - width: 400 px) {
    h1 {
      text - align: center;
    }
}

<h1>Search for a Doctor or Care Provider</h1>
&#13;
&#13;
&#13;

如何解决?

3 个答案:

答案 0 :(得分:2)

@ Zvezdas1989要删除的问题是你有400到px之间的空格,它们需要在一起,就像max-widthtext-align一样。

@media(max-width: 400px) {
    h1 {
      text-align: center;
    }
}

这样可以解决问题。

答案 1 :(得分:1)

由于空格不适用,您需要删除它们以使其有效:

@media (max-width: 400px) {
  h1 {
    text-align: center;
  }
}
<h1>Search for a Doctor or Care Provider</h1>

答案 2 :(得分:0)

您需要删除空格,如下所示:

@media (max-width: 400px) {
    h1 {
        text-align: center;
    }
}
<h1>Hello Friends</h1>

相关问题