Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信小程序~尺度单位 #67

Closed
zhongxia245 opened this issue Jan 12, 2017 · 0 comments
Closed

微信小程序~尺度单位 #67

zhongxia245 opened this issue Jan 12, 2017 · 0 comments

Comments

@zhongxia245
Copy link
Owner

zhongxia245 commented Jan 12, 2017

时间:2017-01-12 11:18:21

零、总结

  1. 屏幕宽度为750rpx, 20rem, 375px。 1px = 2rpx
  2. 设计师设计小程序图,建议使用750px的大小

一、支持的单位

rpx , rem , px

1px = 2rpx
1rem = ( 750/20 ) rpx

二、单位介绍

1. rpx

rpx单位是微信小程序中CSS的尺寸单位,rpx可以根据屏幕宽度进行自适应。 规定的屏幕宽度为 750rpx (其他就说 iphone6 的物理像素)
iphone6 屏幕宽度 375px , 750物理像素=750rpx

因此 1px = 2rpx

  • 因此建议微信小程序设计师按照iphone6的屏幕来设计小程序,设计图宽度为750px, 这样开发的时候,直接用 设计图上量出来多少px , 就是开发中,多少rpx ,不同设备的兼容呢, 微信小程序会自己去计算

2. rem

微信小程序规定屏幕的宽度为 20rem, 那么就换算成 rpx 和 px 的公式就出来了

1rem = 750/20 = 37.5rpx
1rem = ( 750/20/2 ) px
@zhongxia245 zhongxia245 changed the title #001 微信小程序~尺度单位 微信小程序~尺度单位 Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant