html - 带边框图像的表格
问题描述
提供此代码以在单元格周围制作边框图像。是否可以让单元格之间的边框只显示一个边框?而且红色方块只在桌子的角落,而不是在单元格的每个角落。(就像显示普通表格一样,但线条被正方形图像替换)
如果存在使用外部库或 jquery 的解决方案,请告诉我。
.table-bordered > tbody > tr > td, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > td, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > thead > tr > th {
border: 0; /* reset */
border-color: transparent;
border-style: solid;
border-width: 25px;
-moz-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
-webkit-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
-o-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
border-image: url(https://www.w3schools.com/cssref/border.png) 27 fill round;
}
<table class="table table-bordered">
<thead>
<tr>
<th>Foo</th>
<th>Bar</th>
<th>Lols</th>
</tr>
</thead>
<tbody>
<tr>
<td>
something here
</td>
<td>
whatever
</td>
<td>
6,0% / 12% wag.
</td>
</tr>
</tbody>
</table>
解决方案
你可能看起来像这样。
td,
th {
border: 0;
border-color: transparent;
border-style: solid;
-moz-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
-webkit-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
-o-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
border-image: url(https://www.w3schools.com/cssref/border.png) 27 fill round;
border-width: 0 0 25px;
}
.table {
border: 0;
border-color: transparent;
border-style: solid;
border-width: 25px;
-moz-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
-webkit-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
-o-border-image: url(https://www.w3schools.com/cssref/border.png) 27 round;
border-image: url(https://www.w3schools.com/cssref/border.png) 27 fill round;
}
<table class="table table-bordered">
<thead>
<tr>
<th>Foo</th>
<th>Bar</th>
<th>Lols</th>
</tr>
</thead>
<tbody>
<tr>
<td>
something here
</td>
<td>
whatever
</td>
<td># 6,0% / 12% wag.
</td>
</tr>
</tbody>
</table>
推荐阅读
- c++ - 运行最基本的 sfml 应用程序时的性能问题
- android - 将数据发送到我的 RV 适配器时出现问题,我该如何解决?
- mongodb - 分片集群上的 MongoDB skip() 和 limit()
- android - 下载我的应用程序时出现错误 [DF-AA-33]
- javascript - 如何平滑展开元素
- software-collections - SCL Centos nodejs10 - 仍然“安全/最新”
- python - 计算期权 Delta 的最佳实践
- javascript - 弹出式点击在其他几个网站页面中不起作用
- xcode - 在 Xcode 中创建空组的模板
- javascript - 保存文件时Nodemon不会重新启动