I am trying to add a font-awesome icon to the top-left corner of a textarea. I tried using the following solution
.text-box {
margin: 30px auto;
min-width: 480px;
}
.text-container {
margin: 30px auto;
white-space: nowrap;
position: relative;
}
.icon textarea {
position: absolute;
top: 50%;
margin-left: 17px;
margin-top: 17px;
z-index: 1;
color: black;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="text-box">
<div class="text-container">
<span class="text-icon">
<i class="fa fa-list-ol"></i>
</span>
<textarea rows="3">
</textarea>
</div>
</div>
but the alignment is off and the input text is vertically/horizontally centered.