Fontawesome user in placeholder

How to put a font in a placeholder. Here is my code:

<div class="form-group">         
    <input class="form-control" placeholder="username" id="inputdefault" type="text" />
    <input class="form-control" placeholder="password" id="inputdefault" type="text" />
</div>
+6
source share
3 answers

Try as follows:

input {
  padding:10px;
	font-family: FontAwesome;
   
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<form role="form">
  <div class="form-group">
    <input type="text" class="form-control empty" id="iconified" placeholder="&#xf2ba">
  </div>
</form>
Run codeHide result
+3
source

You can try the following:

/* add the font to the input element*/

input {
  font: normal normal normal 14px/1 FontAwesome;
  font-size: inherit;
  text-rendering: auto;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- add the code of the icon in the placeholder-->
<input class="form-control" placeholder="&#xF002;" id="inputdefault" type="text">
Run codeHide result

You can find the codes here.

0
source
<input type="text" class="form-control" placeholder="&#xF002;" id="inputdefault" style="font-family:Arial, FontAwesome" />

A list of hexadecimal codes can be found in the Awesome cheatsheet Font .

0
source

All Articles