简体   繁体   English

如何在输入标签的占位符中添加材质图标

[英]How to add material icon in the placeholder of input tag

i have my input tag as per the following我有我的输入标签,如下所示

 <input type="text" placeholder="search place../>

I want to add a material icon <i class="medium material-icons">location_on</i> into the placeholder with those caption我想将材质图标<i class="medium material-icons">location_on</i>添加到带有这些标题的占位符中



can anyone please tell me how to do it?谁能告诉我该怎么做? I already have included the material icon link stylesheet in HTML file我已经在 HTML 文件中包含了材料图标链接样式表

  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Try this:尝试这个:

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/solid.css">

<input
  type="text"
  placeholder="&#xf689; Search place..."
  style="padding: 5px; font-family: Arial, 'Font Awesome 5 Free';"
/>

Hope it helps, just play around with some padding and css to make it nicer希望它有所帮助,只需使用一些填充和 css 让它更好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM