I am trying to use the has-feedback form class to add an icon on a form field, however with input field sizing, the icon is shown out of bounds, below is jsfiddle of the problem:
jsfiddle
<div class="container">
<div class="row col-md-6">
<form name="form">
<div class="form-group has-feedback">
<label class="control-label" for="userName">Username (BROKEN)</label>
<div class="row">
<div class="col-sm-5">
<input type="text"required class="form-control" />
<span class="glyphicon glyphicon-ok form-control-feedback"></span>
</div>
</div>
</div>
<div class="form-group has-feedback">
<label class="control-label" for="userName">Username (WORKS)</label>
<input type="text"required class="form-control" />
<span class="glyphicon glyphicon-ok form-control-feedback"></span>
</div>
</form>
</div>
</div>
It only works when the field has default sizing which is 100% of the containing form.
Any ideas how to control field size and allow to display icon correctly?
Had the same problem yesterday.
Solved it by adding this css. Just edit the top and right positions to suit your design.
.has-feedback .form-control-feedback {
position: absolute;
top: 3px;
right: 15px;
display: block;
width: 34px;
height: 34px;
line-height: 34px;
text-align: center;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With