wil*_*sjd 24 html css twitter-bootstrap
我正在使用bootstrap并创建了一个表格,我需要将列组合在一起.我可以使用任何引导选项吗?我愿意编写自己的CSS来做这件事,但如果有内置的bootstrap方法,我宁愿不这样做.
例如,在下表中,我希望Current具有一种颜色背景的New列和列具有另一种颜色.
<table>
<thead>
<tr>
<td></td>
<td colspan="2" style="text-align: center;">Current</td>
<td colspan="2" style="text-align: center;">New</td>
</tr>
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Fisrt Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John</td>
<td>Bauer</td>
<td>Jack</td>
<td>Bauer</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
更新:我已经实现了我正在寻找的东西colgroup,唉,自定义CSS(虽然不是很多):http://jsfiddle.net/75v7W/4/
wil*_*sjd 23
我实现了一些我正在寻找的东西colgroup,唉,自定义CSS(虽然不是很多):http://jsfiddle.net/75v7W/4/
注意:对于background-color下面的s,我从成功,错误等中拉出了默认颜色bootstrap.css.如果您已自定义bootstrap.css,这些特定颜色可能不适合您.
CSS
colgroup col.success {
background-color: #dff0d8;
}
colgroup col.error {
background-color: #f2dede;
}
colgroup col.warning {
background-color: #fcf8e3;
}
colgroup col.info {
background-color: #d9edf7;
}
Run Code Online (Sandbox Code Playgroud)
表
<table class="table table-condensed">
<colgroup>
<col>
<col span="2" class="info">
<col span="2" class="success">
</colgroup>
<thead>
<tr>
<td></td>
<td colspan="2" style="text-align: center;">Current</td>
<td colspan="2" style="text-align: center;">New</td>
</tr>
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Fisrt Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John</td>
<td>Bauer</td>
<td>Jack</td>
<td>Bauer</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
如果可以使用bootstrap内置css类,那就更好了.
有一种内置的方式可以高亮显示列:https://jsfiddle.net/DanielKis/wp6bt229/
HTML:
<table class="table table-condensed">
<colgroup>
<col class="bg-success"></col>
<col span="2" class="bg-info"></col>
<col span="2" class="bg-danger"></col>
</colgroup>
<thead>
<tr>
<td></td>
<td colspan="2" class="text-center bg-primary">Current</td>
<td colspan="2" class="text-center">New</td>
</tr>
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Fisrt Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Johnny</td>
<td>English</td>
<td>Bud</td>
<td>Spencer</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
您可以使用
bg-primarybg-successbg-infobg-warningbg-danger用于为列,单元格等着色的Css类
| 归档时间: |
|
| 查看次数: |
35701 次 |
| 最近记录: |