This is one way to use fontawesome icons inside a placeholder:

in the CSS you have to use this code for the class fontAwesome:

  .fontAwesome {
         font-family: 'Helvetica', FontAwesome, sans-serif;
    }

After that in the HTML you have to add the fontawesome class first and then the fontawesome icon code inside the placeholder:

  <input type="text" class="fontAwesome" name="emailAddress" placeholder="&#xf0e0; insert email address ...">

and it's done!!!

You can simply apply the class every time inside your input with the relative code in the placeholder.

And even more, you can use this method by entering the code into a generic element such as a link or a simple text using the same class "fontAwesome" used for the placeholder:

  <a href="#" class="fontAwesome">&#xf118; Great job!!!<a/>

You can see the result:

See the Pen FontAwesome and placeholders by Massimiliano Ranauro (@huckbit) on CodePen.


2,481 7 51