I'll-Be-Back I'll-Be-Back -4 years ago 231
CSS Question

Align Text Input to Right in td?

I am trying to align the Text Input to the right and for some reason it is not doing this.

I have used

style="text-align: right"
in
<td>


See example:

https://jsfiddle.net/DTcHh/31200/

Code

<table class="table">
<thead>
<tr>
<th>Field 1</th>
<th style="text-align:right">Field 1</th>
</tr>
</thead>
<tbody>
<tr>
<td>Text 1</td>

<td style="text-align: right">
<div class="form-group" style="text-align: right">
<input style="width:60px" type="number" class="form-control" value="test">
</div>
</td>
</tr>
</tbody>
</table>

Answer Source

No extra CSS is needed just use Bootstrap pull-right:

https://jsfiddle.net/cp1tvuj3/

<div class="form-group">
          <input style="width:60px" type="number" class="form-control pull-right" value="test">
</div>

Updated fiddle

text-right won't work because the form-control is display: block

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download