Html 没有垂直单元格边框的表格

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11237204/
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 01:19:22  来源:igfitidea点击:

TABLE with no vertical cell borders

htmlcsshtml-table

提问by user1175551

I would like my HTML table to only show the horizontal cell borders. Is there a way where I can hide the vertical cell borders?

我希望我的 HTML 表格只显示水平单元格边框。有没有办法可以隐藏垂直单元格边框?

回答by JSW189

You can add strictly horizontal border lines by styling trtags via CSS.

您可以tr通过 CSS样式化标签来添加严格的水平边框线。

Example CSS:

示例 CSS:

tr {
    border-bottom: 1px solid black;
    border-top: 1px solid black;
    border-collapse: collapse;
}?

Of course, you can use any border style/width/color you choose.

当然,您可以使用您选择的任何边框样式/宽度/颜色。

JS Fiddle: http://jsfiddle.net/XPyzM/

JS小提琴:http: //jsfiddle.net/XPyzM/

回答by Niet the Dark Absol

Assuming you are using old-style <table border="1">, make it <table border="1" rules="rows">.

假设你使用的是 old-style <table border="1">, make it <table border="1" rules="rows">

回答by Jukka K. Korpela

table, th, td {
  border-left: none;
  border-right: none;
}

回答by john ktejik

<style>
  td {border-left: 1px solid black;}
</style>

回答by Deatk

回答by Naidu

You can add strictly horizontal border lines by styling tr tags via CSS.

您可以通过 CSS 设置 tr 标签样式来添加严格的水平边框线。

<TABLE 
    BORDER=1 CELLPADDING=3 CELLSPACING=1 
    RULES=COLS FRAME=BOX
>