2017-09-20 37 views

Odpowiedz

39

iPhone X

@media only screen 
    and (device-width : 375px) 
    and (device-height : 812px) 
    and (-webkit-device-pixel-ratio : 3) { } 

iPhone 8

@media only screen 
    and (device-width : 375px) 
    and (device-height : 667px) 
    and (-webkit-device-pixel-ratio : 2) { } 

iPhone 8 Plus

@media only screen 
    and (device-width : 414px) 
    and (device-height : 736px) 
    and (-webkit-device-pixel-ratio : 3) { } 


iPhone 6 +/6s +/7 +/8 + udostępnia te same rozmiary, a iPhone 7/8 również.


Szukasz konkretnej orientacji?

Portret

Dodaj następującą regułę:

and (orientation : portrait) 

Krajobrazowy

Dodaj następującą regułę:

and (orientation : landscape) 



Odniesienia:

3

Oto niektóre z następujących zapytań o media dla iPhone'ów. Ref link https://mydevice.io/devices/

/* iphone 3 */ 
@media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 1) { } 

/* iphone 4 */ 
@media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 2) { } 

/* iphone 5 */ 
@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (-webkit-device-pixel-ratio: 2) { } 

/* iphone 6, 6s */ 
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (-webkit-device-pixel-ratio: 2) { } 

/* iphone 7, 8 */ 
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (-webkit-device-pixel-ratio: 2) { } 

/* iphone 6+, 6s+, 7+, 8+ */ 
@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (-webkit-device-pixel-ratio: 3) { } 

/* iphone X */ 
@media only screen and (min-device-width: 375px) and (max-device-height: 812px) and (-webkit-device-pixel-ratio: 3) { } 
+0

Powinieneś dodać referencje, np .: Linki do innych odpowiedzi SO, jeśli je skopiowałeś. – nathan

+0

@Nathan answer updated. –