CSS media queries for Samsung s6

荒凉一梦 提交于 2019-12-19 05:20:11

问题


Help please. Can any body tell me about media queries in CSS for Samsung s6 to be more responsive?

@media only screen and 
(min-device-width : 360px) and 
(max-device-width : 640px) and 
(-webkit-min-device-pixel-ratio : 3) { // code here }  

And from where i can test for responsive design for Samsung s6? Any online link or tool please?


回答1:


I've try this :

@media screen 
  and (device-width: 360px) 
  and (device-height: 640px)
  and (-webkit-min-device-pixel-ratio : 4) 
  and (-webkit-device-pixel-ratio : 4)
  and (orientation: portrait) {

/* CSS GO HERE */

}

And it's seems to work. For S6 and S7. I think it's because the Samsung S6 and S7 dimensions are 1440x2560 :

1440 / 4 = 360
2560 / 4 = 640

Hope this help.




回答2:


Chrome dev tools can let you test the query on different screen sizes. Open the developer console (F12) and click the "Toggle device mode" button (the small screen icon). You can select your device or manually set the screen size yourself. For a galaxy S6, the dimensions are 360x640.




回答3:


I recommending you to use following code:

/* Samsung Galaxy S6, S6+, S7, S7+ | 1440×2560 pixels ----------- */
/* Portrait and Landscape */
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 4) {
    /* Styles */
}

/* Landscape */
@media only screen and (min-device-width: 360px) and (max-device-height: 640px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 4) {
    /* Styles */
}

/* Portrait */
@media only screen and (min-device-width: 360px) and (max-device-height: 640px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 4) {
    /* Styles */
}

If you locking for full list of them please check this link, you will find the following devices: Smartphones, iPads, iPads 3, iPhone 4, iPhone 5, iPhone 6, iPhone 6+, Samsung Galaxy S3, Samsung Galaxy S4 , Samsung Galaxy S5, Samsung Galaxy S6, Samsung Galaxy S7, Samsung Galaxy S8, Samsung Galaxy S9

For more information please look at this link and check this link



来源:https://stackoverflow.com/questions/33541139/css-media-queries-for-samsung-s6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!