I am trying to display an icon after a text box within a form-horizontal
Bootstrap form. So I set my text-box width to 80%
and added the icon.
<div class="form-group">
@Html.LabelFor(model => model.Tag, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Tag, new { htmlAttributes = new { @class = "form-control", style = "width: 80%" } })
<img id="tag-status" src="~/Content/Images/alert.png" style="display: inline" />
@Html.ValidationMessageFor(model => model.Tag, "", new { @class = "text-danger" })
</div>
Unfortunately, this places the icon below the text box.
Looking further, I see that the form-control
class includes display: block
. If I remove that, it displays how I want.
But I'm concerned that removing the block style may cause display issues on some devices.
Does anyone know if there's there a Bootstrap way to do what I want?