猿问

在input 输入框前加个 ¥ 符号,然后输入框的字从后往前这是怎么做到的呢,求大神给个示例

在input 输入框前加个 ¥ 符号,然后输入框的字从后往前这是怎么做到的呢,求大神给个示例,但是提交的时候咱们不要这个符号哦?,如何优雅的实现呢,

MMMHUHU
浏览 1208回答 1
1回答

富国沪深

`1.//placeholder默认事件<input type="text" placeholder="¥"&nbsp; dir="rtl"/>2//因为input不支持:after:before 所以可以用bgimginput{ background-image: url(...) }`3.<style>&nbsp; &nbsp; div{&nbsp; &nbsp; &nbsp; position: relative;&nbsp; &nbsp; }&nbsp; &nbsp; input{&nbsp; &nbsp; &nbsp; position: relative;&nbsp; &nbsp; &nbsp; background-color: rgba(0,0,0,0)&nbsp; &nbsp; }&nbsp; &nbsp; .back{&nbsp; &nbsp; &nbsp; position: absolute;&nbsp; &nbsp; &nbsp; top: 2px;&nbsp; &nbsp; &nbsp; left: 5px;&nbsp; &nbsp; &nbsp; display: inline-block;&nbsp; &nbsp; &nbsp; color: rgba(1,1,1,0.5)&nbsp; &nbsp; }</style><div>&nbsp; &nbsp; <input type="text"/>&nbsp; &nbsp; <div class="back">¥</div></div>
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答