可以通过CSS样式来实现。首先,给标题行的单元格添加左边框线样式,然后使用CSS的伪类选择器:after来添加一个border-left样式的伪元素。下面是示例代码:
Title 1
Title 2
Title 3
Content 1
Content 2
Content 3
th {
border-left: 1px solid black;
padding-left: 10px; /* 需要加上左侧的内边距 */
position: relative; /* 开启相对定位 */
}
/* 添加伪元素 */
th:after {
content: "";
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 1px;
border-left: 1px solid black;
}
需注意的是,因为伪元素是绝对定位的,需要开启相对定位,而且需要为标题行单元格添加左侧内边距以避免内容紧贴着边框。另外,其他单元格的边框线需要单独控制以避免重复添加边框线。