在一些安卓旧手机上,app上面的input输入框placeholder 文字居上,不垂直对齐,设置了line-height: normal 也不行
只能写死,比如input高80rpx, line-height: 80rpx,但是这样导致光标很大
在一些安卓旧手机上,app上面的input输入框placeholder 文字居上,不垂直对齐,设置了line-height: normal 也不行
只能写死,比如input高80rpx, line-height: 80rpx,但是这样导致光标很大
我是这么解决的:
搜索框我分为一个大盒子,它作为边框,
里面再放一个盒子,放着图片,搜索框,以及搜索按钮
又放一个盒子包着图片和搜索按钮,
文字不能居中问题,我们用包着图片和搜索按钮的盒子设置flex(display:flex)布局,然后设置align-items:center;
整体设置:
最大的盒子样式设置:flex布局 justify-content:center;align-items:center;其他的微调就可以了
<view class="search">
<view class="searchs">
<image src="/static/serc.png" alt=""></image>
<input type="text" placeholder="输入关键字" placeholder-style="color:#adadad"/>
</view>
<view class="search-text">搜索</view>
</view>
样式:
.search{
height: 66rpx;
line-height: 66rpx;
border-radius: 33rpx;
display: flex;
justify-content: space-between;
align-items: center;
background-color: white;
border:solid 1px #fe7532;
border-right: none;
}
.searchs{
display: flex;
align-items: center;
>image{
padding: 19rpx 24rpx;
width: 26rpx;
height: 28rpx;
}
咚咚咚咚队长 (作者)
没有解决,做了项目一直没上线,就扔那了
2020-09-16 16:02
aaa140
input::-webkit-input-placeholder { line-height:normal } 是酱紫滴 不是直接设置input 刚刚测试 记录一下
2021-02-22 16:36