Bootstrap - 如何为< td&gt ;?设置固定宽度 [英] Bootstrap - how to set up fixed width for <td>?

查看:392
本文介绍了Bootstrap - 如何为< td&gt ;?设置固定宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单方案:

  <tr class="something">
    <td>A</td>
    <td>B</td>
    <td>C</td>
    <td>D</td>
  </tr>

我需要为< td> code>。我尝试过:

I need to set up a fixed width for <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>

对于Bootstrap 3.0:

解决方案

对于Bootstrap 3.0:

For Bootstrap 3.0:

推荐答案

<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:

For Bootstrap 2.0:

bootstrap 2使用: class =span *其中*是宽度的列数。

With twitter bootstrap 2 use: 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> 元素。

** If you have <th> elements set the width there and not on the <td> elements.

这篇关于Bootstrap - 如何为&lt; td&gt ;?设置固定宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆