Html 在 Twitter Bootstrap 中更改 .table-bordered 的线条颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18220365/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change line color of .table-bordered in Twitter Bootstrap
提问by Dsel
I am styling a number of tables with twitter bootstrap and am using the .table.table-bordered
class. The default border color is gray, which is good for all my tables except one. For one table, I would like to change this border color to black and also make the lines thicker if possible. I am using less.
我正在使用 twitter bootstrap 为许多表格设计样式,并且正在使用该.table.table-bordered
课程。默认的边框颜色是灰色,这对我的所有表格都有好处,除了一张。对于一张桌子,我想将此边框颜色更改为黑色,并尽可能使线条更粗。我用的比较少。
I've researched it and found the @tableBorder
variable which I can customize but changing this changes the color of all the tables.
我已经研究过它并找到了@tableBorder
我可以自定义的变量,但是改变它会改变所有表格的颜色。
I tried giving the table a class and putting this in the css file:
我尝试给表格一个类并将其放在 css 文件中:
.differentTable {
@tableBorder: black;
}
...but that did not seem to change anything (not sure why).
...但这似乎没有改变任何东西(不知道为什么)。
Any help would be greatly appreciated.
任何帮助将不胜感激。
回答by koala_dev
@tableBorder
is a variable, not a property.
@tableBorder
是一个变量,而不是一个属性。
You can just add this to your CSS:
您可以将其添加到您的 CSS 中:
.differentTable, .differentTable td{
border-color: black;
}
回答by Adonias Vasquez
The best way is
最好的办法是
.table {
border: 0.5px solid #000000;
}
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td {
border: 0.5px solid #000000;
}
回答by Nanang Koesharwanto
.table-bordered td, .table-bordered th{
border-color: black !important;
}
.table-bordered th : create border for head and foot table.
.table-bordered th : 为头和脚表创建边框。
.table-bordered td : create border for body table
.table-bordered td : 为 body 表创建边框
I have to use '!important', because the border wouldn't change without it.
我必须使用 '!important',因为没有它边界不会改变。
回答by sonyjyoti
This the best way
这是最好的方法
.table-border,
thead,
tbody,
tr {
border: 5px dotted #4c4c4c;
}
change border-style property in bootstrap.
在引导程序中更改边框样式属性。