Html 桌子的黑色细边框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8498005/
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
Thin Black Border for a Table
提问by user311509
I need to have such thin line for the whole table as seen above. The above image is a sample only. My solution, doesn't work. The table shows no border at all.
如上所示,我需要为整个表格设置这样的细线。上图仅为示例。我的解决方案,不起作用。该表根本没有显示任何边框。
Here is my CSS:
这是我的 CSS:
table {
border-width: thin;
border-spacing: 2px;
border-style: none;
border-color: black;
}
回答by Petah
Style the td
and th
instead
样式td
和th
代替
td, th {
border: 1px solid black;
}
And also to make it so there is no spacing between cells use:
并且为了使单元格之间没有间距,请使用:
table {
border-collapse: collapse;
}
(also note, you have border-style: none;
which should be border-style: solid;
)
(另请注意,您border-style: none;
应该拥有哪个border-style: solid;
)
See an example here: http://jsfiddle.net/KbjNr/
在此处查看示例:http: //jsfiddle.net/KbjNr/