Thursday, 21 May 2015

Tagged under:

Extending Form Controls with Bootstrap

Bootstrap includes {some other|various other|several other} useful form components {to make|to create|to produce} your form more attractive.


Creating Prepended and Appended Inputs

{You can add|You can include|You could add} text and icons or buttons before or after any text-based input.
To prepend or append text and icons to {an input|an insight}:
  • Wrap {the text|the writing} or icon {within a|inside a|in just a} element {having the|getting the|obtaining the} class .input-group-addon and {place it|put it|stick it} before or {after the|following the}  element.
  • Wrap {both the|both|the} and text-based  element {within a|inside a|in just a}element and apply the class .input-group on it.

Example Code :

<form>
<div class="row">
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input type="text" class="form-control" placeholder="Username">
</div>
</div>
<div class="col-xs-4">
<div class="input-group">
<input type="text" class="form-control" placeholder="Amount">
<span class="input-group-addon">.00</span>
</div>
</div>
<div class="col-xs-4">
<div class="input-group">
<span class="input-group-addon">$</span>
<input type="text" class="form-control" placeholder="US Dollar">
<span class="input-group-addon">.00</span>
</div>
</div>
</div>
</form>

The output of example will look something like this :
Bootstrap Prepended and Appended Inputs



0 comments:

Post a Comment