如何通过CSS媒体查询考虑移动设备的长宽比?

时间:2019-04-07 17:06:45

标签: css

如果设备的宽高比较小,我想裁剪图库图像。例如。 iPhone 6,7,8与X。

我的代码中必须存在一些错误,因为这应该是可能的:

/* gallery img should be croped on phones with small height (e.g. iphone 6,7,8, but not X) */
/*@media (max-height: 700px){*/
@media (max-aspect-ratio: 16/9){
  #cl_gallery_main{
      max-height: 260px;
      overflow: hidden;
  }
  #cl_gallery_main img{
      margin-top: -15%;
  }
}

最大高度有效,但在iPhone PLUS上,宽高比也为16/9,因此我也要考虑这款手机。

我如何只针对屏幕更高的长宽比?

0 个答案:

没有答案
相关问题