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

微信 H5 页面兼容性解决方案(转) #17

Open
lesonwu opened this issue Dec 5, 2019 · 0 comments
Open

微信 H5 页面兼容性解决方案(转) #17

lesonwu opened this issue Dec 5, 2019 · 0 comments

Comments

@lesonwu
Copy link
Owner

lesonwu commented Dec 5, 2019

前言

最近给公司微信公众号,写了微信h5业务页面,总结分享一下前端开发过程中的几个兼容性坑,项目直接拿的公司页面,所以下文涉及图片都模糊处理了。

1、ios端兼容input光标高度

问题详情描述: input输入框光标,在安卓手机上显示没有问题,但是在苹果手机上
当点击输入的时候,光标的高度和父盒子的高度一样。例如下图,左图是正常所期待的输入框光标,右边是ios的input光标。

image

出现原因分析: 通常我们习惯用height属性设置行间的高度和line-height属性设置行间的距离(行高),当点击输入的时候,光标的高度就自动和父盒子的高度一样了。(谷歌浏览器的设计原则,还有一种可能就是当没有内容的时候光标的高度等于input的line-height的值,当有内容时,光标从input的顶端到文字的底部

解决办法: 高度height和行高line-height内容用padding撑开
例如:

.content{
  float: left;
  box-sizing: border-box;
  height: 88px;
  width: calc(100% - 240px);              
  .content-input{
     display: block;
     box-sizing: border-box;
     width: 100%;
     color: #333333;
     font-size: 28px;
     //line-height: 88px;
     padding-top: 20px;
     padding-bottom: 20px;
  }
}

2、ios端微信h5页面上下滑动时卡顿、页面缺失

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