Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS*响应情况下的通配符_Css - Fatal编程技术网

CSS*响应情况下的通配符

CSS*响应情况下的通配符,css,Css,在我的网站上,我的主要CSS样式表有以下属性: * { margin-top: 0; margin-bottom: 5px; margin-right: 12px; margin-left: 15px; padding: 0; font-family: 'Trebuchet MS', sans-serif; } 但是当用手机观看时,它并不合适。我试过这样做 * { margin-top: 0; margin-bottom:

在我的网站上,我的主要CSS样式表有以下属性:

* {
     margin-top: 0;
    margin-bottom: 5px;
    margin-right: 12px;
    margin-left: 15px; 
    padding: 0; 
    font-family: 'Trebuchet MS', sans-serif;
}
但是当用手机观看时,它并不合适。我试过这样做

* {
     margin-top: 0;
    margin-bottom: 5px;
    margin-right: 12px;
    margin-left: 15px; 
    padding: 0; 
    font-family: 'Trebuchet MS', sans-serif;
}
@media (max-width: 800px) {
    * {
        font-family: 'Trebuchet MS', sans-serif;
    }
  }




当宽度为800px但不工作时,停用*选择器。你们能帮帮我吗?

因为媒体查询写错了,所以它不起作用。你们没有更改媒体查询中的任何内容。 您应该向媒体查询添加新的css规则。在媒体查询中添加800px宽度的规则

@media screen AND (max-width: 800px) {
    * {
        margin-top: 15px;
    margin-bottom: 15px;
    margin-right: auto;
    margin-left: auto; 
    padding: 2px; 
    font-family: 'Trebuchet MS', sans-serif;
    }
  }

添加所需的值。

不要用*为每个元素设置字体。仅将其设置为html或body节点。它将被继承。在媒体查询中,再次分配属性/值-这没有任何区别。你想要实现什么?