我如何在输入字段中添加永久占位符 [英] how do i add permanent place holder inside input filed

查看:65
本文介绍了我如何在输入字段中添加永久占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在输入字段中添加font-icon,所以我使用了此方法

i need to add font-icon inside input field so i used this method

 <input type="text" name="your name" placeholder="&#xe00b; YOUR NAME" style="font-family:Flaticon" class="restrict">

如您所见placeholder="&#xe00b; YOUR NAME",此&#xe00b;显示font-icon,但是我的问题是,当用户键入一些文本占位符Disapper时,我需要将字体图标永久放置在输入域内,例如<lable>

as you see placeholder="&#xe00b; YOUR NAME" this &#xe00b; display font-icon but my problem is when user types some text place holder disapper so i need font icon to be placed permanent inside input field like <lable>

有人可以帮我吗

推荐答案

您不能.您希望它看起来像什么? placeholder根据设计消失.

You can't. What do you expect it to look like? placeholder disappears by design.

如果您要在输入字段前面添加图标前缀,请将它们放到一个容器中,为该容器提供所需的样式,然后在其中放置您的图标和您的input标签.这样,如何引导您的问题解决.

If you want to prefix an icon in front of your input field, put them together in a container, give this container the needed style and put there your icon and your input-tag. That's the way, how bootstrap your problem solves.

简化的示例:

<div class="input-group">
  <div class="input-group-addon">$</div>
  <input type="text" class="form-control" id="exampleInputAmount" placeholder="Amount">
</div>

当然,您需要CSS.

这篇关于我如何在输入字段中添加永久占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆