在Bootstrap 3,我可以随意应用和调整表格列中col-sm-xx的th标签thead.但是这在bootstrap 4中不起作用.如何在bootstrap 4中实现这样的功能?
<thead>
<th class="col-sm-3">3 columns wide</th>
<th class="col-sm-5">5 columns wide</th>
<th class="col-sm-4">4 columns wide</th>
</thead>
Run Code Online (Sandbox Code Playgroud)
查看codeply,前提是它的大小不正确,特别是如果向表中添加一些数据.看看它是如何运行的:
<div class="container" style="border: 1px solid black;">
<table class="table table-bordered">
<thead>
<tr class="row">
<th class="col-sm-3">3 columns wide</th>
<th class="col-sm-5">5 columns wide</th>
<th class="col-sm-4">4 columns wide</th>
</tr>
</thead>
<tbody>
<tr>
<td>123</td>
<td>456</td>
<td>789</td>
</tr>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud) 我有以下布局:
#limited-width {
width: 100%;
max-width: 200px;
margin: 0 auto;
font-size: 18px;
}
ul {
display: flex;
flex-flow: row wrap;
list-style: none;
padding: 0;
margin: 20px;
}
ul > li {
display: block;
text-align: center;
flex: 1 0 auto;
max-width: 100%;
box-sizing: border-box;
margin: 0;
padding: 4px 7px;
border: 2px solid rgba(0,0,0,.3);
background-color: rgba(0,0,0,.03);
}Run Code Online (Sandbox Code Playgroud)
<div id="limited-width">
<ul>
<li>Apple</li>
<li>Orange</li>
<li>Pineapple</li>
<li>Banana</li>
<li>Tomato</li>
<li>Pear</li>
<li>Lemon</li>
</ul>
</div>Run Code Online (Sandbox Code Playgroud)
如您所见,其中的列表项ul具有宽度为的边框2px,但正因为如此,元素之间的边界加倍.我正在寻找一种方法,使边框在元素之间的宽度相同,同时border-collapse使用flexbox 保持外部边框相同(类似于在桌子上工作的方式).这是可能的,如果是的话,怎么样?