记录一次移动开发的bug - pod4g/tool GitHub Wiki
移动开发要注意的问题
常见移动设备尺寸列表:
- 320 iphone4/s iphone5/s (4吋屏幕)
- 360 sumsang galaxy node2/3 s3/4 & Google Nexus 5
- 375 iphone6/s (4.7吋屏幕)
- 384 meizuo pro4 & LG Optimus L70 & Google Nexus 4
- 400
- 412 Google Nexus 6
- 414 iphone6/s plus(5.5吋屏幕)
- 424
- 480
- 540
- 520
- 600 BlackBerry PlayBook & Google Nexus 7
- 720
- 768
- 800
- 900
- 960
- 955
- 966
- 1024 ipad3
在写媒体查询时,可以隔开某些没有的尺寸,但是有的话,一定要注意! 同时,在写css的时候,不要写的正正好,因为屏幕的大小不是连续的
例如在做百度阿拉丁礼物筛选页面时,在其他手机上都是好的,但是在魅族mx pro 4下布局全乱了,问题就出现在我把页面的像素写的刚刚好,没有余地,导致一行浮动放不下了。。
@media screen and (max-width: 414px) {
button, html, input {
font-size: 64px; } }
<!--这段代码是新加的,保证能囊括魅族pro4的384px的逻辑像素-->
@media screen and (max-width: 384px) {
button, html, input {
font-size: 60px; } }
@media screen and (max-width: 380px) {
button, html, input {
font-size: 56px; } }
2016-12-02更新:
解决这种不连续的情况,可以使用js计算来适配所有的设备!包括未来可能会出现的设备!! 但是问题在于,当手动拖页面时,不会自动布局,需要刷新一下。