scss iOS设备的媒体查询

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss iOS设备的媒体查询相关的知识,希望对你有一定的参考价值。

//iPhone 5 + 5s specific selector
@mixin iPhone-5-and-5s-portrait-query {
  @media screen and (device-aspect-ratio: 40/71) {
    @content;
  }
}

@include iPhone-5-and-5s-portrait-query {
  //style goes here
}

/* iPhone 6 landscape */
@media only screen and (min-device-width: 375px)
  and (max-device-width: 667px)
  and (orientation: landscape)
  and (-webkit-min-device-pixel-ratio: 2)
{ }

/* iPhone 6 portrait */
@media only screen
  and (min-device-width: 375px)
  and (max-device-width: 667px)
  and (orientation: portrait)
  and (-webkit-min-device-pixel-ratio: 2)
{ }

/* iPhone 6 Plus landscape */
@media only screen
  and (min-device-width: 414px)
  and (max-device-width: 736px)
  and (orientation: landscape)
  and (-webkit-min-device-pixel-ratio: 3)
{ }

/* iPhone 6 Plus portrait */
@media only screen 
  and (min-device-width: 414px) 
  and (max-device-width: 736px) 
  and (orientation: portrait) 
  and (-webkit-min-device-pixel-ratio: 3)
{ }

/* iPhone 6 and 6 Plus */
@media only screen
  and (max-device-width: 640px),
  only screen and (max-device-width: 667px),
  only screen and (max-width: 480px)
{ }

/* Apple Watch */
@media
  (max-device-width: 42mm)
  and (min-device-width: 38mm)
{ }

以上是关于scss iOS设备的媒体查询的主要内容,如果未能解决你的问题,请参考以下文章

CSS媒体查询仅针对iOS设备[重复]

SCSS 中的媒体查询无法正常工作

scss Bootstrap 3 SCSS媒体查询

scss 媒体查询SCSS

scss Bootstrap v4 SCSS媒体查询

SCSS:按媒体查询分组输出