我正在尝试将文本输入右对齐,但由于某种原因它没有这样做。
我用过style="text-align: right"
在<td>
看例子:
https://jsfiddle.net/DTcHh/31200/
代码
<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>
最佳答案
不需要额外的 CSS 只需使用 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>
text-right
将不起作用,因为 form-control
是 display: block
最初的问题是针对 Bootstrap 3 的。在 Bootstrap 4 中,pull-right is now float-right .
关于html - 将 <td> 中的文本输入与 twitter bootstrap 中的右侧对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42976642/