我正在尝试使 Boostrap 中一个表列的宽度适合内容宽度。第一列的空间应尽可能小。请参阅下面的代码或 jsfiddle 我迄今为止尝试过的内容。
感谢您提前提供任何帮助!
预期结果:
Some Heading
Some text some text Some text some text Some text some text Some text some text:
AAA: Some Text A
B: Some Text B
CCCCC: Some Text C
https://jsfiddle.net/ne45y0gm/
<h4>Some Heading</h4>
<p class="mb-1">Some text some text Some text some text Some text some text Some text some text:</p>
<table class="table table-sm table-borderless">
<tr class="row">
<td class="col-sm-auto">AAA:</td>
<td class="col">Some Text A</td>
</tr>
<tr class="row">
<td class="col-sm-auto">B:</td>
<td class="col">Some Text B</td>
</tr>
<tr class="row">
<td class="col-sm-auto">CCCCC:</td>
<td class="col">Some Text C</td>
</tr>
</table>
<hr>
<div class="row">
<div class="col-sm-auto">AAA:</div>
<div class="col">Some Text A</div>
</div>
<div class="row">
<div class="col-sm-auto">B:</div>
<div class="col">Some Text B</div>
</div>
<div class="row">
<div class="col-sm-auto">CCCCC:</div>
<div class="col">Some Text C</div>
</div>
<hr>
<div class="row">
<div class="col-sm-2">AAA:</div>
<div class="col-sm-10">Some Text A</div>
<div class="col-sm-2">B:</div>
<div class="col-sm-10">Some Text B</div>
<div class="col-sm-2">CCCCC:</div>
<div class="col-sm-10">Some Text C</div>
</div>
拉莫斯之舞
浮云间
相关分类