如何为<td>设置固定宽度? [英] How to set up fixed width for <td>?
问题描述
简单方案:
<tr class="something">
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
我需要为 I need to set up a fixed width for 还有 为了 甚至 但是 But the width of 在 Bootstrap 4.0.0 中,您不能可靠地使用 In Bootstrap 4.0.0 you cannot use the 在 twitter bootstrap 3 中使用:
With twitter bootstrap 3 use: 在 twitter bootstrap 2 中使用:
With twitter bootstrap 2 use: ** 如果您有 ** If you have 这篇关于如何为<td>设置固定宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! 设置一个固定的宽度.我试过了:
<td>
. I've tried:tr.something {
td {
width: 90px;
}
}
td.something {
width: 90px;
}
<td class="something">B</td>
<td style="width: 90px;">B</td>
的宽度还是一样的.
<td>
is still the same.推荐答案
对于 Bootstrap 4.0:
col-*
类(在 Firefox 中有效,但在 Chrome 中无效).您需要使用 OhadR 的答案:For Bootstrap 4.0:
col-*
classes reliably (works in Firefox, but not in Chrome).
You need to use OhadR's answer:<tr>
<th style="width: 16.66%">Col 1</th>
<th style="width: 25%">Col 2</th>
<th style="width: 50%">Col 4</th>
<th style="width: 8.33%">Col 5</th>
</tr>
对于 Bootstrap 3.0:
class="col-md-*"
其中 * 是宽度的列数.For Bootstrap 3.0:
class="col-md-*"
where * is a number of columns of width.<tr class="something">
<td class="col-md-2">A</td>
<td class="col-md-3">B</td>
<td class="col-md-6">C</td>
<td class="col-md-1">D</td>
</tr>
对于 Bootstrap 2.0:
class="span*"
其中 * 是宽度的列数.For Bootstrap 2.0:
class="span*"
where * is a number of columns of width.<tr class="something">
<td class="span2">A</td>
<td class="span3">B</td>
<td class="span6">C</td>
<td class="span1">D</td>
</tr>
<th>
元素在那里设置宽度,而不是在 <td>
元素上设置.<th>
elements set the width there and not on the <td>
elements.
登录
关闭