szmoyu / CodeBackup

0 stars 0 forks source link

移动端web开发之坑---input内文字与同行文字不对齐问题 #6

Open szmoyu opened 6 years ago

szmoyu commented 6 years ago

港币

在chrome中设置

p{ display: flex;justify-content: flex-start;align-items: center }

就可以很好的解决对齐的问题,因为input框中的文字本身就是垂直居中的

在ios中,input内文字的靠下,顶框与同行文字对齐,设置input vertical-align:top;效果良好 在安卓中,input内文字靠上,设置input vertical-align:text-bottom;效果良好 (多台手机已验证)

2、设置input的line-height

https://blog.csdn.net/screaming_color/article/details/74992747

szmoyu commented 6 years ago

移动端input框输入文本时不居中。。。

1、原因:因为有元素有line-height属性 2、解决方法:去掉line-height属性 3、注:要写ie的兼容性line-height:30px\9;