更改浏览器窗口的分辨率大小时CSS媒体查询不起作用

更改浏览器窗口的分辨率大小时CSS媒体查询不起作用,css,responsive-design,media-queries,Css,Responsive Design,Media Queries,我似乎无法将这两个问题结合起来。似乎我在“最大宽度:1360”中列出要显示的内容覆盖了990px必须显示的内容。990px的媒体查询不会覆盖1360px查询中定义的任何内容。我对页脚做了一些修改,但我认为这不是系统设计的方式。我做了一些研究,但我找不到任何人能够解释为什么这不起作用: @media screen and (max-width: 990px) { #header {width: 990px; display: inherit;} #header_info {width: 99

我似乎无法将这两个问题结合起来。似乎我在“最大宽度:1360”中列出要显示的内容覆盖了990px必须显示的内容。990px的媒体查询不会覆盖1360px查询中定义的任何内容。我对页脚做了一些修改,但我认为这不是系统设计的方式。我做了一些研究,但我找不到任何人能够解释为什么这不起作用:

@media screen and (max-width: 990px)    {
#header {width: 990px; display: inherit;}
#header_info {width: 990px;}
#border_header {width:990px;}
#contact_data { display: none;}
#contact_data1 {width: 990px; display: inherit;}
#contact_data1 img {float: left; }
#contact_info {width: 990px;}
#wrapper {width: 990px; float: left; }
#container {width: 990px; float: left; }
#left_window {width: 200px; float: left;  }
#left_window a {font-size:20px;}
#content {width: 687px; }
#right_window {display:none}



#footer {display:none;}
#footer_content {display:none;}
#footer_container {display:none;}
#footer_content_left {display:none;}
#footer_content_center {display:none;}
#footer_content_right {display:none;}



#footer1 {width: 990px; display:inherit;}
#footer_content1 {width: 990px; display:inherit;}
#footer_container1 {width: 990px; display:inherit;}
#footer_content_left1 {width: 150px; display:inherit;}
#footer_content_center1 {width: 150px; display:inherit;}
#footer_content_right1 {width: 150px; display:inherit;}


#product_listing {margin-left: 55px; }

#breakgarage {display: inherit;}



}





@media screen and (max-width: 1360px)    {    
#footer {width: 1360px;}
#footer_content {width: 1360px;}
#footer_container {width: 1360px;}
#footer_content_left {width:330px;}
#footer_content_center {width: 330px;}
#footer_content_right {width: 330px;}

#header {width: 100%;}
#header_info {width: 1360px;}
#border_header {width:1360px;}
#contact_data {width: 1360px;}
#contact_data img {float: left;}
.contact_data_space {padding-left: 75px;}
#contact_info {width: 1360px;}
#wrapper {width: 1360px;}
#container {width: 1360px;}

contact_info img {width: 50%}

}

CSS是级联的。这是自上而下的解释。这就是为什么您的
1360px
样式会覆盖
990px
样式
990px
是1360px的子匹配项,但它具有相同的优先级,因此它会先下降到最后一个覆盖项


颠倒顺序。如果使用“最大宽度”(max width),请自上而下写,以最大的开头,以最小的结尾。

我认为您应该将第二个媒体查询更改为:

@media screen and (min-width: 991px) and (max-width: 1360px)
这样,仅当屏幕大小介于991px和1360px之间时才应用


在您的代码中,第二个媒体查询将始终应用于990px以下的屏幕,因为小于990px的部分也小于1360px,如果您明白我的意思的话…

这也行得通,但是请注意,如果您想应用“更大”的规则(对于
1360px
)对于这两种情况,您最终都会复制代码中的样式。我很感谢您和我的见解。响应式网页设计对我来说还是很新的。我来自PHP编程,具有中级Javascript知识。无论如何,谢谢你们两位。