Ing*_*als 4 html css twitter-bootstrap twitter-bootstrap-3
好的,我试图用输入字段做一个表.要设置每个字段的大小我理解我必须在标题中设置col-size.
<thead>
<tr>
<th class="col-sm-2">Large</th>
<th class="col-sm-2">Large</th>
<th class="col-sm-1">Small</th>
<th class="col-sm-2">Large</th>
<th class="col-sm-1">Small</th>
<th class="col-sm-2">Large</th>
<th class="col-sm-2">Large</th>
</tr>
</thead>
Run Code Online (Sandbox Code Playgroud)
然而,输入扩展到它们的最大宽度而不考虑col-size.
可能这是对Bootstrap的不当使用,但我认为它是带有标题的内联输入的最佳选择.
另外,假设我希望这个特定的网格有18列,而不是默认的12,这可能就在这个特殊情况下?
Lif*_*fes 15
只需将"form-control"类添加到输入中,bootstrap就可以完成剩下的工作.
这样做可以更容易地添加列或更改宽度,因为您只需更改标题而不是每行/输入.
<table class="table table-condensed">
<thead>
<tr>
<th class="col-sm-12 col-md-4">Large</th>
<th class="col-sm-12 col-md-2">Small</th>
<th class="col-sm-12 col-md-2">Small</th>
<th class="col-sm-12 col-md-2">Small</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="text" class="form-control" />
</td>
<td>
<input type="text" class="form-control" />
</td>
<td>
<input type="text" class="form-control" />
</td>
<td>
<input type="text" class="form-control" />
</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
您需要将该类col-md-*用于col-sm-*平板电脑屏幕和col-xs-*移动屏幕的普通屏幕,还有col-lg-*更大的屏幕,您可以组合所有这些类以使其响应,如:
<div class="row">
<div class="col-sm-12">
<table class="table table-bordered">
<thead>
<tr>
<th>Very Small</th>
<th>Very Small</th>
<th>Very Small</th>
<th>Large</th>
<th>Small</th>
<th>Medium</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-sm-1">
<input class="col-sm-12" placeholder="col-sm-1" />
</td>
<td class="col-sm-1">
<input class="col-sm-12" placeholder="col-sm-1" />
</td>
<td class="col-sm-1">
<input class="col-sm-12" placeholder="col-sm-1" />
</td>
<td class="col-sm-4">
<input class="col-sm-12" placeholder="col-sm-4" />
</td>
<td class="col-sm-2">
<input class="col-sm-12" placeholder="col-sm-2" />
</td>
<td class="col-sm-3">
<input class="col-sm-12" placeholder="col-sm-3" />
</td>
</tr>
</tbody>
</table>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21993 次 |
| 最近记录: |