[英]TABLE with no vertical cell borders
I would like my HTML table to only show the horizontal cell borders.我希望我的 HTML 表格只显示水平单元格边框。 Is there a way where I can hide the vertical cell borders?
有没有办法可以隐藏垂直单元格边框?
You can add strictly horizontal border lines by styling tr
tags via CSS.您可以通过 CSS 设置
tr
标签样式来添加严格的水平边框线。
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/
table, th, td {
border-left: none;
border-right: none;
}
假设您使用的是旧式<table border="1">
,请将其<table border="1" rules="rows">
。
<style>
td {border-left: 1px solid black;}
</style>
I finally figured this out, you need to put border-collapse
property in style of table
!我终于想通了,您需要将
border-collapse
属性放在table
样式中!
CSS: CSS:
table {
border-collapse: collapse;
}
tr {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
And your table will only have horizontal lines!你的桌子只会有水平线!
th, td {
border-bottom: 1px solid #ddd;
}
see https://www.w3schools.com/css/css_table.asp见https://www.w3schools.com/css/css_table.asp
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
>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.