【发布时间】:2021-02-07 04:04:03
【问题描述】:
我正在尝试使用引导程序制作一个可编辑的表格。
因此,它必须包含一些输入。
表格列的宽度通常适合其内容。 Bootstrap 的form-control 设置了width: 100%,但是我觉得太大了,希望输入更小。
我在another question 中发现我可以在我的输入中使用w-auto 来绕过它。
但是,当我这样做时,表格似乎并没有将列大小缩小到它的内容。
我想我应该以某种方式告诉表格必须扩展哪一列来填充空间。
我尝试将w-100 设置为另一列,但它破坏了另一列中的另一个input-group。
<table class="table table-sm">
<thead>
<th>Problematic column</th>
<th>2</th>
<th>3</th>
</thead>
<tbody>
<td class="table-danger"><input type="number" class="form-control w-auto"></td>
<td>Something else</td>
<td>
<div class="input-group">
<div class="input-group-prepend">
<button class="btn btn-outline-secondary" type="button">X</button>
</div>
<input type="text" class="form-control"/>
</div>
</td>
</tbody>
</table>
【问题讨论】:
标签: css bootstrap-4