当我使用宽度作为我的参数“最小宽度”媒体查询工作正常。但是当我使用最小高度和最大高度时,我输入的最后一个尺寸是有效的。我的代码:
@media only screen
and (min-height : 0px) , screen and (max-height: 600px) {
#guy{
position:absolute;
top:180px;
width:100%;
height:680px;
background:url(../img/guy.png);
background-repeat:no-repeat;
z-index:1;
background-size: 650px 450px;
}
}
@media only screen
and (min-height : 601px) , screen and (max-height: 800px) {
#guy {
position: absolute;
top: 80px;
width: 100%;
height: 680px;
background: url(../img/guy.png);
background-repeat: no-repeat;
z-index: 1;
background-size: 450px 250px;
background-position: center center;
}
}
@media only screen
and (min-height : 800px) , screen and (max-height: 1000px) {
#guy {
position: absolute;
top: 160px;
width: 100%;
height: 680px;
background: url(../img/guy.png);
background-repeat: no-repeat;
z-index: 1;
background-size: 650px 450px;
background-position: center center;
}
}
@media only screen
and (min-height : 1001px) , screen and (max-height: 1600px) {
#guy {
position: absolute;
top: 220px;
width: 100%;
height: 680px;
background: url(../img/guy.png);
background-repeat: no-repeat;
z-index: 1;
background-size: 850px 650px;
background-position: center center;
}
}
@media only screen
and (min-height : 1601px) , screen and (max-height: 4000px) {
#guy {
position: absolute;
top: 260px;
width: 100%;
height: 680px;
background: url(../img/guy.png);
background-repeat: no-repeat;
z-index: 1;
}
}
而且无论我的屏幕分辨率如何,只有最小高度:1600px 和最大 4000px 有效,如果我没记错的话,我可以使用高度作为参数正确吗?我也不认为存在语法问题。有人遇到过这个问题吗?