适配访问器的css网页页面细线报表设计方案

2021-03-13 11:22 jianzhan
普遍的做法是运用 CSS2 的 "border-collapse:collapse;" 特性合拼报表边框;并对 table 元素设定左侧框和上边框,对 th 和 td 元素设定右侧框和下边框。

Markup:

拷贝编码
编码以下:

<table>
<tr>
<th>table head (row1, col1)</th>
<th>table head (row1, col2)</th>
<th>table head (row1, col3)</th>
</tr>
<tr>
<td>table data (row1, col1)</td>
<td>table data (row1, col2)</td>
<td>table data (row1, col3)</td>
</tr>
<tr>
<td>table data (row2, col1)</td>
<td>table data (row2, col2)</td>
<td>table data (row2, col3)</td>
</tr>
</table>

CSS:

拷贝编码
编码以下:

table{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;background:#efefef;}
th,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}