更改引导程序表的边框颜色的最佳方法是什么?

时间:2015-06-01 12:51:06

标签: html css twitter-bootstrap

我使用bootstrap表类。 默认的边框颜色是灰色/银色 - 我想。

但我想将边框颜色更改为红色,但我无法让它工作。

这就是我所拥有的 enter image description here

CSS

.table {
border: red solid 1px !important;
}

HTML:表格

<table class="table table-bordered piechart-key ">

    <thead >
        <th></th>
        <th></th>
        <th> Item Summary</th>
        <th> Item List</th>

    </thead>
    <tbody>
        <tr>
            <td width="30"></td>
            <td width="200">
                &gt; 50% of students answered these items correctly
            </td>
            <td width="50">5/25</td>
            <td width="100">5,10,15,19,23</td>
        </tr>
        <tr>
            <td width="30"></td>
            <td width="200">50% up to 75% of students answered these items correctly</td>
            <td width="50">8/25</td>
            <td width="100">3,7,11,13,14,16,21,22</td>
        </tr>
        <tr>
            <td width="30"></td>
            <td width="200">&ge; 75% of students answered these items correctly</td>
            <td width="50">12/25</td>
            <td width="100">1,2,4,6,8,9,12,17,18,20,24,25</td>
        </tr>
    </tbody>
</table>

Here is my JSFiddle

更改引导程序表的边框颜色的最佳方法是什么?

1 个答案:

答案 0 :(得分:6)

尝试将其应用于细胞:

.table td{
    border: red solid 1px !important;
}

标题:

.table th{
    border: red solid 1px !important;
}

http://jsfiddle.net/w0b73dwt/7/

修改

OBS:我使用了!important 指令,因为我没有找到其他简单的方法。当然,我们都知道这是一个糟糕的CSS实践,但在某些情况下,我们必须承担风险。 其他方式将准确找到bootstrap如何声明其样式并为 td th 创建具有更高优先级的css选择器。在这种情况下,这可能会在第一次引导更新时中断。

相关问题