Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.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_Responsive Design - Fatal编程技术网

Css @媒体没有像我想的那样工作

Css @媒体没有像我想的那样工作,css,responsive-design,Css,Responsive Design,我正在学习响应式设计,@media并没有以我认为应该的方式工作。我有一个酒吧。以下是css: .subnav-fixed { background-color: #eeeeee; position: fixed; top: 50px; left: 0; right: 0; z-index: 1030; border-color: #d5d5d5; border-width: 0 0 1px; -webkit-border-radius: 0; -moz-b

我正在学习响应式设计,@media并没有以我认为应该的方式工作。我有一个酒吧。以下是css:

.subnav-fixed {
  background-color: #eeeeee;
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  z-index: 1030;
  border-color: #d5d5d5;
  border-width: 0 0 1px;
  -webkit-border-radius: 0;
  -moz-border-radius: 0;
  border-radius: 0;
}

@media (max-width: 767px) {
  .subnav-fixed {
    top: 61;
  }
}
当我的页面低于767px时,我希望顶部下降到61px。这并没有发生。@media在.subnav类之后。除了被告知如何使这项工作,我更想了解正在发生的事情。任何帮助或链接都会很好

试试看

@media all and (max-width:767px){
 .subnav-fixed {
    top: 61px;
  }
}
添加了
all和
,而且您刚刚编写了
top:61px