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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:59:04  来源:igfitidea点击:

Thin Black Border for a Table

htmlcss

提问by user311509

enter image description here

在此处输入图片说明

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 tdand thinstead

样式tdth代替

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/