2

我似乎无法让这两个查询一起工作。似乎我在“最大宽度:1360”中列出的显示内容覆盖了我必须为 990 像素显示的内容。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%}

}
4

2 回答 2

6

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

反转您的订单。如果您使用max-width,请从上到下从最大的结尾开始写到最小的结尾。

于 2013-04-04T15:51:12.693 回答
1

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

@media screen and (min-width: 991px) and (max-width: 1360px)

这样它只会在屏幕尺寸在 991px 和 1360px 之间时应用。

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

于 2013-04-04T15:54:57.353 回答