【发布时间】:2012-07-12 16:18:18
【问题描述】:
我正在开发一个使用 twitter-bootstrap-rails 设置样式的非常简单的应用程序。我的模型索引页面有一个显示数据的表格,它看起来非常棒。问题在于,如果有人在其中一个字段中输入一串很长的完整文本(例如 URL),则该列的宽度会拉伸并挤压所有其他列。我想要一些方法来强制列的宽度并告诉浏览器分解很长的单词。
到目前为止,我尝试为每个 <th> 添加一个类并尝试使用 CSS 来控制宽度。这是一个例子
<table>
<thead>
<tr>
<th class="column1"> etc
<th class="column2"> etc
</tr>
</thead>
<tbody>
<tr>
<td class="column1"> etc
<td class="column2" etc
</tr>
</tbody>
</table>
然后我在我的样式表中使用了它
th.column1 { width: 300px;
word-wrap:break-word;}
td.column1 { width: 300px;
word-wrap:break-word;}
到目前为止,这对我不起作用,我想知道我是否需要大量复制我的代码。
【问题讨论】:
-
,Twitter-bootstrap-rails 与 bootstrap 本身有什么不同吗?
标签: html css ruby-on-rails-3 column-width twitter-bootstrap-rails