简体   繁体   English

解析错误@media only屏幕和(方向:横向)

[英]Parse Error @media only screen and (orientation: landscape)

I have this media query css: somehow it just won't pass validation, but if I take out the orientation queries, it will validate successfully. 我有这个媒体查询CSS:不知何故它不会通过验证,但是如果我删除了方向查询,它将成功验证。 I simply cannot find anything wrong with it. 我根本找不到任何问题。 all curly brackets are balanced,what could be wrong? 所有花括号都平衡了,怎么了?

/* media query---MOB */ / *媒体查询--- MOB * /

@media screen and (min-width:200px) and (max-width: 640px) {
/* ....CSS classes.... */

@media only screen and (orientation: landscape) {    
    .loginImgDiv {
    margin-left: 70%; 
    width:100%; 
    height:auto; 
    }
  } /* End of @media only screen and (orientation: landscape)*/
  @media only screen and (orientation: portrait) {
    .loginImgDiv {
    margin-left: 45%; 
    width:100%; 
    height:auto; 
    }
  } /* End of  @media only screen and (orientation: portrait)*/
} /*End of media query---MOB */

I think you have to separate out both orientations you cannot mix them 我认为您必须将两个方向分开才能将它们混合在一起

check this link orientation reference 检查此链接方向参考

change it to the following 将其更改为以下内容

@media screen and (min-width:200px) and (max-width: 640px) and (orientation:landscape){
/* ....CSS classes.... */


    .loginImgDiv {
    margin-left: 70%; 
    width:100%; 
    height:auto; 
    }
}
@media screen and (min-width:200px) and (max-width: 640px) and (orientation:potrait){
  .loginImgDiv{
    margin-left: 45%; 
    width:100%; 
    height:auto; 
    }
  } /* End of  @media only screen and (orientation: portrait)*/
 /*End of media query---MOB */

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM