首页 > 解决方案 > 如何在输入标签的占位符中添加材质图标

问题描述

我有我的输入标签,如下所示

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

我想<i class="medium material-icons">location_on</i>用这些标题在占位符中添加一个材质图标



谁能告诉我该怎么做?我已经在 HTML 文件中包含了材料图标链接样式表

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

标签: htmlinputplaceholdergoogle-material-icons

解决方案


尝试这个 :

<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';"
/>

希望它有所帮助,只需使用一些填充和 css 使其更好


推荐阅读