html - 如何在空白处开发带有水平边框的表格
问题描述
我想在空列中开发带有垂直边框的表格内容。首先,我尝试<hr/>
在第一列和第三列之间使用,但它不起作用。
这是这样编写的当前代码。
<table>
<tr>
<th>Machine Weight: </th>
<td>50kg</td>
</tr>
<tr>
<th>Carrying Capacity: </th>
<td>30kg</td>
</tr>
</table>
解决方案
我没有比这更好的主意,也许有人会有更好的主意?
table {
border-collapse : collapse;
margin : 2em 1em;
font-family : Arial, Helvetica, sans-serif;
font-size : 16px;
}
td,th {
padding : .3em 0;
}
th { text-align: left; width: 12em; }
td { text-align: right; width: 9em; }
tr { position : relative; }
tr::after {
position : absolute;
display : block;
top : 0;
left : 0;
right : 0;
overflow : hidden;
content : '————————————————————————————————————————————————————————';
color : lightgrey;
line-height : 1.7em;
z-index : -1;
}
caption {
color : crimson;
font-weight : bold;
font-size : 2em;
text-align : left;
padding-bottom : .4em;
}
<table>
<caption>Specifications</caption>
<tbody>
<tr>
<th>Machine Weight: </th>
<td>50kg</td>
</tr>
<tr>
<th>Carrying Capacity: </th>
<td>30kg</td>
</tr>
</tbody>
</table>
推荐阅读
- javascript - 如何在 CSS 中滚动浏览整个图像
- c - Which is the order of filling a triangular matrix?
- mysql - 如何停止mysql
- php - 如何将角度发送的对象转换为laravel中的关联数组?
- postgresql - 根据统一或正常法则使用随机数更新 PostgreSQL 列
- php - 仅在提交的值错误时显示错误消息
- ruby - HttpClient 可以引发哪些异常?
- vue-material - 使用 Vue-Material 覆盖标签中的背景颜色
- javascript - 如何使用 JavaScript 创建一个无序列的 HTML 列表(没有奇怪的行为)?
- mysql - MySQL 2 表与外键结合 - 查看具有特定功能的条目