input 在有 padding 的情况下,background 显示不正常
发布于 4 年前 作者 guiying15 16823 次浏览 来自 问答

index.wxml:

<view class="test-input">
  <input />
</view>

index.wxss:

.test-input input{
  display: inline-block;
  background-image: url(https://res.wx.qq.com/wxopenforumres/zh_CN/htmledition/comm_htmledition/style/base/layout_head_z_@2318d1d.png);
  background-repeat: no-repeat;
  background-position-y: center;
  background-position-x: 12rpx;
  background-size: 500rpx;
  background-origin: border-box;
  padding-left: 50rpx;
}

在开发者工具和 iOS 手机上,input 里面会出现 2 个背景图,(安卓手机上看起来正常)

如果我删掉 padding-left 一句,bug 消失,但那不是我想要的效果。__
__

2 回复

我的也是,如果不写padding,图标就会在文字下面,写了padding就会出现两个background-image 好纠结,又解决方法吗?

我也遇到这个问题 楼主解决了吗

回到顶部