表没有垂直单元格边框

时间:2021-05-31 22:21:50

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表格只显示水平单元格边框。有没有办法可以隐藏垂直细胞边界?

5 个解决方案

#1


20  

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

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

Example 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/

#2


4  

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

假设您使用的是旧式

,请将其设为

#3


2  

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

#4


1  

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

#5


-6  

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
>

#1


20  

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

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

Example 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/

#2


4  

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

假设您使用的是旧式

,请将其设为

#3


2  

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

#4


1  

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

#5


-6  

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
>