1

i want to put this icon inside of my textarea in below image.

enter image description here

and here is my code:

<div class="form-group" style="text-align: right;width: 100%;">
          <textarea row=100 cols=60
                    type="text"
                    id="input"
                    formControlName="txt"
                    placeholder="متن ...">
          </textarea>
          <span class="icon-user"></span>
        </div>

anyone knows how i must do for this problem ?

Mohandes
  • 271
  • 3
  • 6
  • 17
  • This has already been asked before: https://stackoverflow.com/questions/45764431/how-can-i-add-a-font-awesome-icon-to-a-textarea – aman Nov 02 '18 at 17:21

2 Answers2

5

Here is the example: https://jsbin.com/laduyemewo/edit?html,css,output

The crucial changes here is to the set position: relative; to the parent <div class="form-group"> and apply for <span class="icon-user"></span> - position: absolute; with a bottom and left properties based on your sizes.

pepsilike
  • 206
  • 1
  • 7
0

You can achieve it using css like this.
.icon-user { position:relative; top: -10px; left: -100px; }
Adjust the values of top and left according to your needs. :)
Other way you could add position: absolute to both the textarea and the icon.

Vipul Sharma
  • 525
  • 9
  • 23