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

kyo*_*kyo 5 html css twitter-bootstrap

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

但我想将边框颜色更改为红色,但我无法使其工作.

这就是我所拥有的 在此输入图像描述


CSS

.table {
border: red solid 1px !important;
}
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

这是我的JSFiddle


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

Mau*_*aes 6

尝试将其应用于单元格:

.table td{
    border: red solid 1px !important;
}
Run Code Online (Sandbox Code Playgroud)

对于标题:

.table th{
    border: red solid 1px !important;
}
Run Code Online (Sandbox Code Playgroud)

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


编辑

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