移动端 h5

本文分享了针对移动端UI的优化策略,包括取消点击高亮、iphonex适配技巧、文字不可选、图片不可操作、input框样式调整等,特别强调了placeholder的展示问题及fixed布局的替代方案。
  • 取消点击时候的透明区域
    -webkit-tap-highlight-color: rgba(0,0,0,0);
  • iphonex 适配
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, viewport-fit=cover">
    
    padding-bottom: constant(safe-area-inset-bottom); /* 兼容 iOS < 11.2 */
    padding-bottom: env(safe-area-inset-bottom); /* 兼容 iOS >= 11.2 */
  • 文字不能选择
    user-select: none;
  • 图片不能操作
    pointer-events: none;
  • outline: none;去掉input foucs态 input 框样式
  • input placeholder 样式修改
input::-webkit-input-placeholder {
    /* WebKit browsers */
    color: #cccccc;
}

input:-moz-placeholder {
    /* Mozilla Firefox 4 to 18 */
    color: #cccccc;
}

input::-moz-placeholder {
    /* Mozilla Firefox 19+ */
    color: #cccccc;
}

input:-ms-input-placeholder {
    /* Internet Explorer 10+ */
    color: #cccccc;
}
  • 移动端 ios input placeholder 展示不全 line-height: normal;

  • 有输入框相关的页面不要用fixed,改成absolute
  • align-items: center; // 不能垂直居中 加, line-height: normal;
  • placeholder //字体要小于input 的字体 否则会被挡住部分展示不全

转载于:https://www.cnblogs.com/Running00/p/11291064.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值