相关疑难解决方法(0)

如何设置<td>的固定宽度?

简单方案:

  <tr class="something">
    <td>A</td>
    <td>B</td>
    <td>C</td>
    <td>D</td>
  </tr>
Run Code Online (Sandbox Code Playgroud)

我需要设置一个固定的宽度<td>.我试过了:

tr.something {
  td {
    width: 90px;
  }
}
Run Code Online (Sandbox Code Playgroud)

td.something {
  width: 90px;
}
Run Code Online (Sandbox Code Playgroud)

对于

<td class="something">B</td>
Run Code Online (Sandbox Code Playgroud)

乃至

<td style="width: 90px;">B</td>
Run Code Online (Sandbox Code Playgroud)

但宽度<td>仍然相同.

css html-table width twitter-bootstrap

472
推荐指数
11
解决办法
81万
查看次数

表列大小

Bootstrap 3,我可以随意应用和调整表格列中col-sm-xxth标签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)

css html-table twitter-bootstrap bootstrap-4

73
推荐指数
6
解决办法
12万
查看次数

标签 统计

css ×2

html-table ×2

twitter-bootstrap ×2

bootstrap-4 ×1

width ×1